4

So I'm clicking on this link:

<a href="intent://www.google.com#Intent;scheme=http;action=android.intent.action.VIEW;end">Google</a> 

(I know its a silly example, since it could just be http://www.google.com, but its illustrative of the problem)

I determined this URI from

Log.v(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://www.google.com")).toUri( Intent.URI_INTENT_SCHEME)); 

I see the following in logcat:

08-02 08:32:34.708 I/ActivityManager( 71): Starting activity: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://www.google.com cmp=com.android.browser/.BrowserActivity } 08-02 08:32:34.748 E/Tab ( 4188): onReceivedError -10 intent://www.google.com#Intent;scheme=http;action=android.intent.action.VIEW;end The protocol is not supported 

Rather than redirecting to www.google.com I get the "Web page not available" page.

If I launch the identical intent using the am binary, it succeeds.

adb -e shell am start -d http://www.google.com -a android.intent.action.VIEW 

I see this in logcat

08-02 08:47:42.488 I/ActivityManager( 71): Starting activity: Intent { act=android.intent.action.VIEW dat=http://www.google.com flg=0x10000000 cmp=com.android.browser/.BrowserActivity } 

The ultimate goal is to have a URL that launches a specific activity in an app (and theres no way for someone to get to this page without having the app installed). I know I can also define a custom scheme, but since its a global namespace I'd rather not do that. I also know I can use http:// for this purpose, but I don't want the user to be prompted whether they want to open the URL in the browser or my app.

Any ideas?

1 Answer 1

7

I ran into the same problem

Adding the following code to my Activity in the AndroidManifest.xml solved my problem:

<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.