I want to launch my own application when the web link in browser is clicked. I search a lot on internet,and the method of solving this question is similar. But mine does't work. There is no effect when i click the web link Is there some other things i don't notice? Can anyone tell me where my application is wrong?Thank you
Here is my program:
the link is: google
URLApp.java:
public class URLApp extends Activity {
/** Called when the activity is first created. */
public void OnCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
final Intent intent = getIntent();
final Uri uri = intent.getData();
Log.i("++++++++++++++++++++++", uri.getScheme().toString());
}
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.receiver"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".URLApp"
android:label="@string/app_name"
android:launchMode="singleTask">
<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"></data>
<data android:host="www.google.com"></data>
</intent-filter>
</activity>
</application>
</manifest>
Edit: After i define my own URL scheme,the program works. My own web link is
<a href="myapp://test">click me!</a>
<data android:scheme="myapp"></data>
Why it does not work by using android:scheme="http" Does anyone have the same problem?