If the android app is to be launched from a url link, first the activity should be added with an intent filter
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
android:host="www.example.com"
android:pathPrefix="/gizmos" />
android:label="@string/title_gizmos" >
android:host="www.example.com"
android:pathPrefix="/gizmos" />
android:host="gizmos" />
Now in the app just handle it
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
}
Inorder to quickly test it, use the below adb command
$ adb shell am start
-W -a android.intent.action.VIEW
-d
references:
https://developer.android.com/training/app-links/deep-linking
No comments:
Post a Comment