我試圖在android上攔截我自己的應用程序的URL,以便用戶可以在應用程序而不是瀏覽器中打開URL。 (我還沒有瀏覽器支持)。應用程序不攔截url
這是我在做什麼
<activity android:name=".ui.activity.MainActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PICK_ACTIVITY" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:host="myapp.com" />
<data android:pathPattern=".*"/>
</intent-filter>
</activity>
出於某種原因,只要我打開myapp.com
它仍保持打開瀏覽器,不給我在我的應用程序打開URL的選項。我正在模擬器上運行API 16。我已經關閉了仿真器幾次並重新開始,但仍然是同樣的行爲。
爲了避免我的個人應用程序的URL中的任何錯誤。我甚至嘗試過:
<data android:host="goo.gl" android:scheme="http" />
<data android:host="goo.gl" android:scheme="https" />
該應用程序攔截上述網址,但只有第一次。如果我在提供的選項中單擊'JUST ONCE',則在重新啓動模擬器之前,我再也沒有選擇該選項。
有沒有人經歷過這個?我可能會做錯什麼?
刪除'安卓pathPattern',因爲你似乎不被使用它,看看是否有幫助。 – CommonsWare