/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// This is the definition of the activity in the AndroidManifest.xml file <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> // Here's how to get the data out inside the activity itself. Put in the onCreate function 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();); }