I have my app running in the foreground and when I issue the adb command below I get the Warning message. It is saying the Intent has been delivered but I'm not sure how to receive it in my MainActivity. Any help with this issue would be greatly appreciated.
adb shell am start -a com.ilw.admin.INSTALL_COMPLETE
Starting: Intent { act=com.ilw.admin.INSTALL_COMPLETE }
Warning: Activity not started, intent has been delivered to currently running top-most instance.
AndroidManifest.xml Activity
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="com.ilw_admin.INSTALL_COMPLETE"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
CodePudding user response:
Activity is SingleTop as mentioned in the manifest. So if the activity is already on top of the stack, and the activity is launched again, onNewIntent will be called and intent will be delivered here.
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
}