Диплинкинг в андроиде

привет, я только начал использовать глубокую ссылку в Android. Когда я запускаю приложение на устройстве, приложение устанавливается на устройстве, но не отображается в списке приложений. Это мой код

deeplinkig.manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.deeplinking"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="21" />

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

                <!--  <category android:name="android.intent.category.LAUNCHER" /> -->
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />               

                <data
                    android:host="gizmos"
                    android:scheme="example" />
                <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
            </intent-filter> 
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data
                    android:host="www.example.com"
                    android:pathPrefix="gizmos"
                    android:scheme="example" />               

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

глубинная ссылка.java

public class MainActivity extends ActionBarActivity {

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

        Intent intent = getIntent();
        String action = intent.getAction();
        Uri data = intent.getData();

    }
}

когда я запускаю из adb, приложение открывается, и adb показывает следующий результат, а на устройстве открывается приложение, которое показывает «hello world»

Starting: Intent { act=android.intent.action.VIEW dat=example://gizmos pkg=com.d
eeplinking }
Status: ok
Activity: com.deeplinking/.MainActivity
ThisTime: 327
TotalTime: 327
Complete

это желаемый результат. Я думал, что откроется приложение www.example.com. Заранее спасибо


person user2083175    schedule 01.10.2014    source источник


Ответы (1)


Это приложение не отображается в списке приложений, так как оно не обрабатывает намерения с android.intent.category.LAUNCHER, поскольку оно закомментировано в вашем коде. Это намеренно?

person R4ng3LII    schedule 01.10.2014