2017-08-24 1 views
1

インスタントアプリケーションを公開する準備が整いましたが、AIAアプリケーションをGoogle PlayのAIA開発トラックで実行しているときに問題が発生しています。
AndroidスタジオからAIAアプリが完全に動作しますが、この問題は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) } 

当社のAIAは非常にGoogleが提供するサンプルのように、アプリの他の機能に記載されている活動を開くこととしてACTION_VIEWインテントを実行するように設定されています。
私たちのアプリがURL経由で開かれたとき、私たちのベース機能のルータアクティビティに送信され、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 URI、URL paramsはを解体し、次のようにテントを構築します:

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スタジオからAIAアプリを実行しているときは発生しません。

追加情報:

Android Studio 3.0 Beta 2 
Gradle plugin: 3.0.0-beta2 
Gradle wrapper distribution: 4.1-rc-1 
+0

重複していません。また、私はすでにソリューションを追加しました。あなたは全体のポストを読んだことがありますか? – lgfz71

+0

以下の質問に答えてください。質問の編集ではありません。 –

+0

回答する担当者はいらない –

答えて

1

これは、GoogleのプレイからAIAアプリを実行している場合、文字列の参照はマニフェストとうまく再生されないこと、が判明しました。スキームの文字列値を明示的に設定すると、問題が修正されます。

<data android:scheme="https" /> 

<data android:scheme="@string/filter_scheme_secure" /> 

の交換

は、問題を解決します。参考のため

1

data属性は、文字列リソースすることができ、いくつかの属性をリスト行うサービスタグと比較すると、リソース、文字列のみ

https://developer.android.com/guide/topics/manifest/data-element.html

することはできません。私は考えることができる(ラベル)

https://developer.android.com/guide/topics/manifest/service-element.html

主な理由は、ラベルが異なる言語にすることができ、実行時に変更されていることです。 URIスキームのオプションはあまり多くなく、アプリのライフタイム中に変更されません。

関連する問題