tags:

views:

569

answers:

3

I am building an Android application that requires OAuth. I have all the OAuth functionality working except for handling the callback from Yahoo. I have the following in my AndroidManifest.xml :

  <intent-filter>
    <action android:name="android.intent.action.VIEW"></action> 
    <category android:name="android.intent.category.DEFAULT"></category> 
    <category android:name="android.intent.category.BROWSABLE"></category>
    <data android:host="www.test.com" android:scheme="http"></data> 
  </intent-filter>

Where www.test.com will be substituted with a domain that I own. It seems :

  • This filter is triggered when I click on a link on a page.
  • It is not triggered on the redirect by Yahoo, the browser opens the website at www.test.com
  • It is not triggered when I enter the domain name directly in the browser.

So can anybody help me with

  • When exactly this intent-filter will be triggered?
  • Any changes to the intent-filter or permissions that will widen the filter to apply to redirect requests?
  • Any other approaches I could use?

Thanks for your help.

+1  A: 

So I changed my approach to use a custom scheme, rather than a web URL and it now all works as expected.

So my callback URL is:
X://callback

and my intent-filter is:

<intent-filter>
    <action android:name="android.intent.action.VIEW"></action> 
    <category android:name="android.intent.category.DEFAULT"></category> 
    <category android:name="android.intent.category.BROWSABLE"></category> 
    <data android:scheme="X"></data> 
</intent-filter>

where X is the name of my customer scheme.

Dave Allison
A: 

Thank you, that works great for me too. I'm not dealing with OAuth, but the ability to register a scheme and have the browser launch my app is exactly what I needed.

Olivier
A: 

Hi, tried this but the browser never starts my app when typing X:// inside it.

An outside link is Ok but is this really working for you when typing a URL inside the Browser ?

(Using Android 2.2 on emulator)

Thanks.

Assaf
No. It only works when I click on a X:// link in a page or through a redirect to X:// . It does not work when you type the URL in to the browser. In my scenario I use a redirect so all fine.
Dave Allison