2017-10-04 11 views
-1

私は検索で見つかったいくつかのことを試しましたが、httpやhttpsのURLでは何も動作しないようです。私は今AndroidManifest.xmlで以下のコードを使用しています。http/httpsが動作しないAndroidのインテントフィルタ

<intent-filter android:label="@string/app_name" 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="example" android:host="item" /> 
    <data android:scheme="https" android:host="example.com" android:pathPrefix="" /> 
    <data android:scheme="https" android:host="example.com" android:pathPrefix="/" /> 
    <data android:scheme="https" android:host="example.com" android:pathPrefix="/somepage" /> 
    <data android:scheme="https" android:host="example.com" android:pathPrefix="/somepage/" /> 
</intent-filter> 

例:// itemはアプリケーションを起動するために動作します。 https://example.comは機能せず、ブラウザのページを開くだけです。私は、各データタグを別のインテントフィルタに分割しようとしましたが、それはまだ動作しません。どんな助けでも大歓迎です。

はEDIT: 全マニフェスト:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    package="***" 
    android:versionCode="1" 
    android:versionName="1.0" 
    > 

    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> 
    <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/> 

    <uses-sdk 
     android:minSdkVersion="16" 
     android:targetSdkVersion="22" /> 

    <application 
     android:name=".MainApplication" 
     android:allowBackup="true" 
     android:label="@string/app_name" 
     android:icon="@mipmap/ic_launcher" 
     android:theme="@style/AppTheme" 
     android:largeHeap="true"> 
     <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> 
     <activity 
     android:name=".MainActivity" 
     android:label="@string/app_name" 
     android:configChanges="keyboard|keyboardHidden|orientation|screenSize" 
     android:windowSoftInputMode="adjustResize"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 

    <intent-filter android:label="@string/app_name" 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="example" android:host="item" /> 
     <data android:scheme="https" android:host="example.com" android:pathPrefix="" /> 
     <data android:scheme="https" android:host="example.com" android:pathPrefix="/" /> 
     <data android:scheme="https" android:host="example.com" android:pathPrefix="/somepage" /> 
     <data android:scheme="https" android:host="example.com" android:pathPrefix="/somepage/" /> 
    </intent-filter> 


     </activity> 
     <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> 
    </application> 


</manifest> 

編集2: 私が見つけたその意図作品(アプリで開きます)私は、コマンドラインを介してこれを実行する場合: adb shell am start -W -a android.intent.action.VIEW -d "https://example.com/" *package*と最後のスラッシュが必要です。後続のスラッシュなしでは機能しません。 しかし、アンドロイドクロムブラウザのリンクをクリックすると(スラッシュの有無にかかわらず)、アプリでは開きません。リンクはアプリではなくブラウザで開きます。以下の問題を修正しました追加

+0

をフルマニフェストを追加してくださいしてください – Cliff

+0

@Cliffは、上記追加 –

答えて

2

私はこれがあることを願っています<data android:pathPattern="/.*"></data>

はあなたに役立ちますが

すべての
0

まず、あなたがADBに、このコマンドでそれをテストすることができ

adb shell am start 
    -W -a android.intent.action.VIEW 
    -d "https://example.com" *YOUR PACKAGE* 
第2のDeepLinkの削除で

を削除しました(android:pathPrefix = "")

削除してください

<activity 
     android:name=".activities.ParseDeepLinkActivity" 
     android:exported="true"> 
     <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 

      <data 
       android:host="deeplink" 
       android:scheme="wizzo" /> 

      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 

     </intent-filter> 
    </activity> 

編集:

このように、インテントフィルタは、アクティビティタグの内側にあることを確認してください

android:label="@string/app_name" android:autoVerify="true" 
+0

私はちょうど ''を試してみました。私はアクティビティタグ内にインテントフィルタを持っています。私は完全なマニフェストで質問を編集しました。 –

+0

コマンドラインで試しましたか? – Cliff

+0

コマンドラインから「エラー:アクティビティが開始されていない、インテントを解決できない{act = android.intent.action.VIEW dat = https://example.com/... flg = 0x10000000 pkg = com」というエラーが表示されます。 .example launchParam = MultiScreenLaunchParams {mDisplayId = 0 mFlags = 0}} ' –

関連する問題