tags:

views:

80

answers:

1

I am working on an application wich has its own URI prefix. (dchub:// in this case)

Searching all over and read a lot but i got a bit confused, is there a way when someone open his browser, clicks on a link starting with dchub:// my app starts using this address?

so far found a lot of examples the otherway around opening the browser from your app but thats not what i'm looking for.

Thanks a lot, Johan

A: 

To register a protocol in your android app, add an extra block to the AndroidManifest.xml.

<manifest>
 <application>
   <activity>
           <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="dchub"/>
            </intent-filter>
   </activity>
 </application>
</manifest>
Thierry-Dimitri Roy
Thanks a lot, i've figured that, now i'm a bit stuck in the next part. [code] Uri data = getIntent().getData(); if (data.equals(null)) { } else { String scheme = data.getScheme(); String host = data.getHost(); int port = data.getPort(); } [/code] i got some nullpointerexceptions if i start the app normally, it works fine if i open from the webpage. So i thought lets include some check for nullvalue but that didn't solve it. any suggestions how i can start the app just by selecting it? //sorry for bad formatting, the manual doesn't help it says four spaces, did that resaved no changes :S
Johan