Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

Basically I have the same question as described in How to implement my very own URI scheme on Android

Basically I have the same question as described in How to implement my very own URI scheme on Android

Source Link
Timo Ernst
  • 16.1k
  • 25
  • 115
  • 175

How to use intents for Android custom URL schema?

Basically I have the same question as described in How to implement my very own URI scheme on Android

I followed the instructions from the answered questions and added to my android manifest:

<activity android:name=".MyUriActivity"> <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="myapp" android:host="path" /> </intent-filter> </activity> 

Also, I added a new activity like this:

import android.app.Activity; import android.os.Bundle; public class MyUriActivity extends Activity { @Override public void onCreate(Bundle b){ System.out.println("URI CLICKED!"); } } 

My Android app is based on Phonegap, so I simply added a link to my index.html like this:

<a href="myapp://foo">Click me</a> 

When I clicked, I see in my console the following error:

03-14 12:23:16.177: E/Cordova(629): Error loading url myapp://foo 03-14 12:23:16.177: E/Cordova(629): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=myapp://foo } 03-14 12:23:16.177: E/Cordova(629): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1545) 03-14 12:23:16.177: E/Cordova(629): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416) 03-14 12:23:16.177: E/Cordova(629): at android.app.Activity.startActivityForResult(Activity.java:3351) 03-14 12:23:16.177: E/Cordova(629): at android.app.Activity.startActivityForResult(Activity.java:3312) 03-14 12:23:16.177: E/Cordova(629): at android.app.Activity.startActivity(Activity.java:3522) 03-14 12:23:16.177: E/Cordova(629): at android.app.Activity.startActivity(Activity.java:3490) 03-14 12:23:16.177: E/Cordova(629): at org.apache.cordova.CordovaWebViewClient.shouldOverrideUrlLoading(CordovaWebViewClient.java:209) 03-14 12:23:16.177: E/Cordova(629): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:274) 03-14 12:23:16.177: E/Cordova(629): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:376) 03-14 12:23:16.177: E/Cordova(629): at android.os.Handler.dispatchMessage(Handler.java:99) 03-14 12:23:16.177: E/Cordova(629): at android.os.Looper.loop(Looper.java:137) 03-14 12:23:16.177: E/Cordova(629): at android.app.ActivityThread.main(ActivityThread.java:4745) 03-14 12:23:16.177: E/Cordova(629): at java.lang.reflect.Method.invokeNative(Native Method) 03-14 12:23:16.177: E/Cordova(629): at java.lang.reflect.Method.invoke(Method.java:511) 03-14 12:23:16.177: E/Cordova(629): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 03-14 12:23:16.177: E/Cordova(629): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 03-14 12:23:16.177: E/Cordova(629): at dalvik.system.NativeStart.main(Native Method) 

So it seems like I am missing the activity. What's wrong?