我們正準備發佈我們的即時應用,但是,在Google Play中的AIA開發軌道中運行我們的AIA應用時,我們遇到了問題。
我們的AIA應用程序完全可以從Android Studio運行,但是當試圖在Play商店中運行真實設備時會出現此問題。
任何幫助表示讚賞。SecurityException:不允許啓動活動意圖
錯誤問題:
java.lang.SecurityException: Not allowed to start activity Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=https://www.example.com/... pkg=com.example (has extras) }
我們的友邦保險被設置爲運行ACTION_VIEW
意圖來打開應用程序的其他功能上市活動,由谷歌提供的樣本非常喜歡。
當我們的應用程序通過URL打開時,它將被髮送到我們的基本特徵中的路由器Activity,以處理解析URI並打開適當的活動來處理URL路徑。
- 基本特徵 - UrlRouterActivity
- 特徵1 - Feature1Activity
基體特徵的清單:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rentpath.lib">
<application>
<activity
android:name=".activity.UrlRouterActivity"
android:noHistory="true"
android:launchMode="singleInstance"
android:theme="@style/Theme.AppCompat.NoDisplay">
<intent-filter android:autoVerify="true">
<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:scheme="https" />
<data android:host="www.example.com" />
<data android:pathPrefix="/path" />
</intent-filter>
</activity>
</application>
</manifest>
特徵1個清單:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rentpath.lib.pdp">
<application>
<activity
android:name=".activity.Feature1Activity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/filter_scheme_secure" /> <!-- String resource for https -->
<data android:host="www.example.com" />
<data android:pathPrefix="/action_feature_1" />
</intent-filter>
<intent-filter>
<action android:name="action_feature_1"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
我們的路由器活動德es解析URL參數並構造一個Intent,如下所示:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https:www.example.com/action_feature_1?some_param=some_value"));
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setPackage(context.getPackageName());
startActivity(intent);
開始此活動會導致上面提到的異常。
同樣,只有在Google Play中的開發軌道上運行AIA應用時纔會發生這種情況。
從Android Studio運行AIA應用程序時不會發生這種情況。
其他信息:
Android Studio 3.0 Beta 2
Gradle plugin: 3.0.0-beta2
Gradle wrapper distribution: 4.1-rc-1
不,它不是重複的。另外,我已經添加了解決方案。你甚至讀過這篇文章嗎? – lgfz71
請回答下面的問題,而不是對問題的編輯 –
您不需要任何代表回答 –