我在android中创建启动器。让我解释一下情况。Android创建启动器但无法启动其他应用程序
案例1:当我从android studio运行myLauncher应用程序时,它首先作为普通应用程序运行。然后我打开myLauncher中的应用程序抽屉,然后点击图标启动另一个应用程序,它工作正常。在退出应用程序后,我又被带回到myLauncher,因为它在android堆栈上。这是我想要的行为。案例2:在我的应用程序安装在Android上后,我按Home按钮选择默认启动程序,然后选择myLauncher作为默认启动程序。它会打开,然后我在myLauncher中打开应用程序抽屉。点击任何图标启动另一个应用程序,它不起作用。
尽管我在科尔多瓦工作,但我不认为这个问题与科尔多瓦有关,因为当myLauncher没有作为启动器运行时,所有工作都可以正常工作。
Intent launchIntent = cordova.getActivity().getApplicationContext().getPackageManager().getLaunchIntentForPackage(args.get(0).toString());
cordova.getActivity().getApplicationContext().startActivity(launchIntent);
logcat的为案例1:
01-10 11:37:57.526 1555 1638 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.android.dialer cmp=com.android.dialer/.DialtactsActivity} from uid 10057 on display 0
01-10 11:37:57.526 1555 1638 W ActivityManager: Activity is launching as a new task, so cancelling activity result.
01-10 11:37:57.536 1555 1638 D : HostConnection::get() New Host Connection established 0x7f1132abef40, tid 1638
01-10 11:37:57.545 1236 1236 E EGL_emulation: tid 1236: eglCreateSyncKHR(1370): error 0x3004 (EGL_BAD_ATTRIBUTE)
01-10 11:37:57.610 3983 3983 D CordovaInterfaceImpl: Sending activity result to plugin
01-10 11:37:57.612 1555 1638 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
01-10 11:37:57.629 3983 4017 W PluginManager: THREAD WARNING: exec() call to Apps.start blocked the main thread for 104ms. Plugin should use CordovaInterface.getThreadPool().
01-10 11:37:58.025 1555 1575 I ActivityManager: Displayed com.android.dialer/.DialtactsActivity: +333ms
01-10 11:37:58.308 3983 3983 I Choreographer: Skipped 30 frames! The application may be doing too much work on its main thread.
01-10 11:37:58.464 3983 4025 E Surface : getSlotFromBufferLocked: unknown buffer: 0x7f11433b9d90
logcat的案例2:
01-10 11:34:15.739 1555 1803 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.android.dialer cmp=com.android.dialer/.DialtactsActivity} from uid 10057 on display 0
01-10 11:34:15.739 1555 1803 W ActivityManager: Activity is launching as a new task, so cancelling activity result.
01-10 11:34:15.791 1555 1575 D : HostConnection::get() New Host Connection established 0x7f1132cba040, tid 1575
01-10 11:34:16.463 1555 1575 D gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
01-10 11:34:16.566 1555 1638 W InputMethodManagerService: Window already focused, ignoring focus gain of: [email protected] attribute=null, token = [email protected]
当你点击图标,没有动作发生,或者只是它打开并突然关闭? –
不采取行动。 –
打印一次,你开始,让我们知道包 – Piyush