Android深层链接无效

时间:2016-07-12 08:37:44

标签: android deep-linking

我正在尝试按照此link在我的应用中实施deeplinking。但没有得到结果。任何人都可以帮助我。这是我的详细活动

public class DetailedActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.detailed_activity);

    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();
    Log.d("data", String.valueOf(data));
}
}

这是我的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.example.geelani.deeplinking.DetailedActivity"
        android:label="DetailedActivity" >
       <intent-filter android:label="@string/filter_title_viewgizmos">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
    <data android:scheme="http"
          android:host="www.example.com"
          android:pathPrefix="/gizmos" />
    <!-- note that the leading "/" is required for pathPrefix-->
    <!-- Accepts URIs that begin with "example://gizmos” -->
    <data android:scheme="example"
          android:host="gizmos" />

</intent-filter>
    </activity>
</application>

0 个答案:

没有答案