Created
June 14, 2011 13:54
-
-
Save solarsailer/1024944 to your computer and use it in GitHub Desktop.
Basic implementation of URL scheme in Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Manifest --- | |
<activity android:name=".URLScheme"> | |
<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="http" | |
android:host="www.a_url.com" | |
android:pathPrefix="/a_path" /> | |
</intent-filter> | |
</activity> | |
--- Activity --- | |
public class URLScheme extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
Intent intent = getIntent(); | |
String action = intent.getAction(); | |
String data = intent.getDataString(); | |
Log.v("rdv", "broadcast : action=" + action + ", data=" + data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment