1
我將我的應用程序設置爲接收與這些意圖過濾器和此處理程序的共享意圖。我在共享菜單中看不到它。應用程序未顯示在共享菜單中
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https"/>
</intent-filter>
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
if (Intent.ACTION_SEND.equals(action) && type.equals("text/plain")) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(R.string.pick_profile);
builder.setItems(getConnProfNames(connectionProfiles), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
selectedItem = connectionProfiles.get(which);
DownloadTask.execute();
}
});
}
有沒有這樣的事情共享意圖。應用程序可以使用Intents以不同的動作,類型,臨時演員和數據共享數據。大多數這些應用程序將使用ACTION_SEND,但取決於應用程序,其他參數的差別很大。使用你的意圖過濾器,你只會使用http和https方案來捕獲Intents,而你的代碼不會限制文本/純文本的類型。這一切都取決於「共享菜單」在觸發時的作用,無論您的代碼是否正常工作。 –
具體而言,我試圖處理來自Dolphin Browser的共享鏈接意圖。 – sajattack