Moh*_*zen 6 android kiosk-mode android-activity android-5.0-lollipop
我将我的应用程序设置为设备所有者,当我打电话时屏幕固定startLockTask().我现在的问题,当我尝试使用此方法运行另一个应用程序时:
Intent i = getPackageManager().getLaunchIntentForPackage("com.example.test");
startActivityForResult(i,Intent.FLAG_ACTIVITY_NEW_TASK);
Run Code Online (Sandbox Code Playgroud)
(什么都没发生)我要做什么让它运行?
编辑:我试过添加
dpm.setLockTaskPackages(deviceAdmin, new String[] { getPackageName() ,"com.example.test"});
Run Code Online (Sandbox Code Playgroud)
它也没有发布.
您应该检查applicationId设备上是否安装了该应用程序。例如,在您的情况下,applicationId是com.example.test。如果未安装应用程序,您可以将用户带到市场或让他们选择应用程序。
String packageName = "com.example.test";
.
.
.
Intent i = context.getPackageManager().getLaunchIntentForPackage(packageName);
if (i == null) {
i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("market://details?id=" + packageName));
// Open app in google play store:
// i.setData(Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName));
}
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
771 次 |
| 最近记录: |