一.activity的AndroidManifest注册中,添加隐式启动的data:
<data android:host="MainActivity" android:scheme="com.***.***.**.task"
tools:ignore="AppLinkUrlError" />
<activity
android:name="com.****.****.****.ui.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/MainActivityTheme">
<intent-filter>
<data android:host="MainActivity" android:scheme="com.****.****.****"
tools:ignore="AppLinkUrlError" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
二:另一个APP隐式启动
public void starAct() {
Intent intent = new Intent();
ComponentName cn = new ComponentName("com.****.****.****",
"com.****.****.****.ui.MainActivity");
intent.setComponent(cn);
Uri uri = Uri.parse("com.****.****.****.ui.MainActivity");
intent.setData(uri);
startActivity(intent);
}