【问题标题】:How to Launching an other app from an intent with different process?如何从具有不同过程的意图启动其他应用程序?
【发布时间】:2018-10-09 12:55:16
【问题描述】:

实际上,我正在尝试通过 Uri Intent 从“App A”启动“App B”,但是当我最小化应用程序时,它会在与“App A”相同的过程中打开,它在后台仅显示一个应用程序即“App A”和“App B”正在该过程中加载。

从“应用 A”启动“应用 B”的代码

    Uri uri = Uri.parse("MyappB://pt?user=userID&pass=Password"); 
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(uri);
    startActivity(intent);

应用内 B 清单文件

 <activity android:name=".common.controller.ParseDeepLinkActivity">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:scheme="MyappB"
                android:host="pt"
                />
        </intent-filter>
    </activity>

它会启动第二个应用程序 B,但当我最小化时,过程将相同,我不会在后台看到两个应用程序,它仅在后台显示应用程序 A 并在其中加载应用程序 B。

如何获得应用 A 和应用 B 的两个独立进程?

【问题讨论】:

    标签: android android-intent android-launcher android-task


    【解决方案1】:
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setComponent(ComponentName.unflattenFromString("MyappB://ptuser=userID&pass=Password"));
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    

    【讨论】:

    • 如何在MyappB的manifest中声明?同样的,我在做什么?
    猜你喜欢
    • 2019-05-31
    • 1970-01-01
    • 1970-01-01
    • 2015-08-27
    • 2017-08-23
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    • 1970-01-01
    相关资源
    最近更新 更多