Created
February 5, 2013 10:53
-
-
Save jschmid/4713706 to your computer and use it in GitHub Desktop.
Android Activity with a custom protocol
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
// In the onCreate() | |
Intent intent = getIntent(); | |
if (Intent.ACTION_VIEW.equals(intent.getAction())) { | |
Uri uri = intent.getData(); | |
Log.i(TAG, "Started by a user clicking " + urlStr); | |
doSomethingWithTheUrl(uri.toString();); | |
} |
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
<activity android:name=".MyActivity" android:label="@string/app_name"> | |
<!-- open the app when a foo://www.example.com link is clicked --> | |
<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:scheme="foo" /> | |
</intent-filter> | |
</activity> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment