i get this string in a browser redirect
intent://view?id=123#Intent;package=com.myapp;scheme=myapp;launchFlags=268435456;end;
how do i work with it ?
found in : http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/
i get this string in a browser redirect
intent://view?id=123#Intent;package=com.myapp;scheme=myapp;launchFlags=268435456;end;
how do i work with it ?
found in : http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/
You have your answer in the part 1 of the same article :
http://fokkezb.nl/2013/08/26/url-schemes-for-ios-and-android-1/
Your activity must have an intent filter matching the given intent Here you have :
package=com.myapp;scheme=myapp
Your app package must be com.myapp and the url scheme is myapp:// So you must declare your activity like that :
<activity android:name=".MyActivity" >
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="myapp" />
</intent-filter>
</activity>
Then your activity will be automatically opened by android.
Optionnaly you can work with the uri received from your code, for example in the onResume method (why onResume ? -> because it is always called after onNewIntent) :
@Override
protected void onResume() {
super.onResume();
Intent intent = getIntent();
if (intent != null && intent.getData() != null) {
Uri uri = intent.getData();
// do whatever you want with the uri given
}
}
If your activity uses onNewIntent, i recommend to use setIntent so that code above is always executed on last intent :
@Override
protected void onNewIntent(Intent intent) {
setIntent(intent);
}
Does this answers your question ?