我在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