我的应用程序应该处理共享文本。例如来自亚马逊应用程序的URL。所以我增加了以下意图过滤器,以我的主要活动:Android意图有时“处理”而不是ACTION_SEND
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
在我的我的活动的onCreate功能,我处理的意图,像这样:
intent = getIntent();
if(intent.getAction() != null) {
if (intent.getAction().equals(Intent.ACTION_SEND)) {
if (intent.getType().equals("text/plain")) {
onNavigationDrawerItemSelected(1);
}
}
}
的问题是,有时在共享操作之后不会调用onCreate函数。 我检查了onResume方法,实际上这就是所谓的。问题是意图操作不是“ACTION_SEND”,而是packagename.handled,并且不包含所需的信息。
这是为什么?
您是否尝试在活动的清单中更改'android:documentLaunchMode'和'android:launchMode'? –