Android 如何将意向从我的一个应用发送到我的另一个应用?
我有一个类Android 如何将意向从我的一个应用发送到我的另一个应用?,android,android-intent,android-service,Android,Android Intent,Android Service,我有一个类IntentService,它位于com.mypackage.app1.receiver(第一个应用程序): 我在舱单中登记: <service android:name=".IntentService" > <intent-filter> <action android:name="com.mypackage.START_INTENT"/> <category android:name="com.myp
IntentService
,它位于com.mypackage.app1.receiver
(第一个应用程序):
我在舱单中登记:
<service android:name=".IntentService" >
<intent-filter>
<action android:name="com.mypackage.START_INTENT"/>
<category android:name="com.mypackage.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</service>
不幸的是,IntentService
目前没有收到SenderActivity
发送的意图。我必须做什么才能收到它?更换:
<service android:name=".IntentService" >
<intent-filter>
<action android:name="com.mypackage.START_INTENT"/>
<category android:name="com.mypackage.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</service>
与:
以匹配您与startService()
一起使用的意图
此外,由于有一个名为IntentService的Android SDK类,我建议您将服务的名称更改为其他名称。替换:
<service android:name=".IntentService" >
<intent-filter>
<action android:name="com.mypackage.START_INTENT"/>
<category android:name="com.mypackage.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</service>
与:
以匹配您与startService()
一起使用的意图
另外,由于有一个名为IntentService
的Android SDK类,我建议您将服务的名称更改为其他名称
<service android:name=".IntentService" >
<intent-filter>
<action android:name="com.mypackage.START_INTENT"/>
<category android:name="com.mypackage.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</service>
<service android:name=".IntentService" >
<intent-filter>
<action android:name="com.learningleaflets.START_INTENT"/>
</intent-filter>
</service>