在Android上调用另一个应用程序

时间:2014-02-20 20:18:26

标签: android android-intent

有很多方法,比如条形码扫描, how does "com.google.zxing.client.android.SCAN" work in android?

现在我启动APP A,现在线程中有一个APP B.但是你可以尝试使用BarCode App,如果我以这种方式从APP C调用BarCode,则系统中没有BarCode的进程。我是否必须在APP B的设置中做一些事情?

App A调用App B, 在App B中:

<activity   android:name="com.amp.act1"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.amp.intent.action.INVOKE_APP"/>               
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

在App A中:

Intent intent = new Intent("com.amp.intent.action.INVOKE_APP");
startActivityForResult(intent, R.id.CALL_VPAY_AIR);

我是否必须在某处注册意图动作com.amp.intent.action.INVOKE_APP?

2 个答案:

答案 0 :(得分:0)

如果您在运行较新版本android的设备上运行。您可能必须为清单中的活动将export flag设置为true。

http://developer.android.com/guide/topics/manifest/activity-element.html#exported

答案 1 :(得分:0)

看来你正在尝试隐含意图? 在这种情况下,您可能希望将CATEGORY_DEFAULT类别添加到com.amp.act1的intent-filter

  

&lt; category android:name =“android.intent.category.DEFAULT”/&gt;

来源: http://developer.android.com/guide/components/intents-filters.html