Android : Deeplinking in android

on Wednesday, October 1, 2014


hi i just started using deep linking in android.When i run the app in device the app is installed in the device but doesn't appears in the app list.This is my code


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>


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();

}
}


when i run from adb the app is opening and adb shows the following result and in device the application is opened which shows "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


is this the desired result. I thought one running this app www.example.com will open.. Thanks in advanced


0 comments:

Post a Comment