Android 如何根据我在服务中使用的意图使用自定义操作?

Android 如何根据我在服务中使用的意图使用自定义操作?,android,android-intent,action,custom-attributes,intentfilter,Android,Android Intent,Action,Custom Attributes,Intentfilter,在我的清单中,我在我的活动中添加了: <intent-filter> <action android:name="webradio.disneychannel.ACTION_DIALOG_CLOSE" /> <category android:name="android.intent.category.DEFAULT" /> </ intent-filter> 其中ACTION\u DIALOG\u CLOSE是一个String=webrad

在我的清单中,我在我的活动中添加了:

<intent-filter>
 <action android:name="webradio.disneychannel.ACTION_DIALOG_CLOSE" />
 <category android:name="android.intent.category.DEFAULT" />
</ intent-filter>
其中
ACTION\u DIALOG\u CLOSE
是一个
String=webradio.disneychannel.ACTION\u DIALOG\u CLOSE


但是当活动开始时,在恢复中,
this.getIntent().getAction()
始终返回null…

当服务调用
startActivity()
时,您的活动是否已经在运行?您发布的内容应该可以正常工作,您是否可以发布更多代码,以便我们看到正在发生的情况?可能在后台有此活动的其他实例,这可能是原因?如果此意图启动此活动,则操作将是
“webradio.disneychannel.action\u DIALOG\u CLOSE”
,如果您以另一种方式开始活动,那么操作将不同。如果没有更多的代码,我就不知道发生了什么。
Intent close = new Intent(ACTION_DIALOG_CLOSE);
close.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(close);