2014-10-01 22 views
0

您好,我只是用我android.When運行設備的應用程序被安裝在設備中,但不會出現在應用程序li​​st.This是我的代碼Deeplinking android系統

deeplinkig的應用深層鏈接開始。清單

<?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> 

deeplinking.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示出了下面的結果和在設備中的應用被打開其示出了「世界你好」

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將打開。在先進

回答

1

由於此應用程序不會出現在應用程序列表中,因爲它不與android.intent.category.LAUNCHER處理的意圖,因爲它是在你的代碼註釋掉。這是故意的嗎?