Skip to content

Instantly share code, notes, and snippets.

@solarsailer
Created June 14, 2011 13:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solarsailer/1024944 to your computer and use it in GitHub Desktop.
Save solarsailer/1024944 to your computer and use it in GitHub Desktop.
Basic implementation of URL scheme in Android
--- 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