且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

code明确启动外部应用程序

更新时间:2022-12-21 18:21:42

尝试这样的事情...

Try something like this...

在清单中的myOtherApp使用一个意图过滤器OtherAppActivity与公司特定意图,例如...

In the manifest for 'myOtherApp' use an intent filter for 'OtherAppActivity' with a company specific intent, example...

<activity
    android:name=".OtherAppActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="com.mycompany.DO_SOMETHING" />
    </intent-filter>
</activity>

那么,在呼唤的应用程序,使用...

Then, in the 'calling' app, use...

Intent intent = new Intent();
intent.setAction("com.mycompany.DO_SOMETHING");
context.startActivity(intent);