我們正在與意圖過濾器下面寫一個Android應用:在Android中,你可以讓Gmail在一個單獨的任務中運行一個意圖嗎?
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="www.appname.com"
android:scheme="http" />
<data
android:host="www.appname.com"
android:scheme="https" />
</intent-filter>
Android用戶與Gmail誰收到鏈接到我們的應用程序可以選擇我們的應用程序,如下圖所示:
但是,當我們查看最近的應用程序時,看起來我們的應用程序正在gmail進程中運行,這不是我們想要的。特別是如果應用程序已經在運行,我們希望gmail將正在運行的進程傳遞給應用程序,以便將它加載到我們的應用程序中。參閱Gmail進程如何有一個嵌入(單獨的實例),其內部運行的應用程序,而應用程序在其自己的進程中運行:
的意圖過濾器的任何建議,以解決此將不勝感激。 android文檔對這種情況根本沒有幫助。
該屏幕截圖與進程無關。它與任務有關:https://developer.android.com/guide/components/tasks-and-back-stack.html – CommonsWare
謝謝@CommonsWare幫助我獲得命名權,因爲我是相當新的Android系統。另一個任務可以完成Gmail的意圖,比如已經運行的應用程序的任務?運行主要活動的多個副本會很昂貴並且可能不穩定。 – spirographer
在清單中的''上嘗試'android:launchMode =「singleTask」''。 –
CommonsWare