0

Hi i have to do connectivity between browser and android app. I referred the link [http://stackoverflow.com/questions/2958701/launch-custom-android-application-from-android-browser.][1] They have suggested to use special scheme.

<intent-filter>
    <data android:scheme="my.special.scheme" />
    <action android:name="android.intent.action.VIEW" />
</intent-filter>

and path would be like <a href="my.special.scheme://other/parameters/here"> in your web app.

I am running it on emulator. through localhost address. What will be the exact path for special scheme

i have given

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

and in web app on button action

   <FORM METHOD="LINK" ACTION="Integration://hello">
<INPUT TYPE="submit" VALUE="Clickable Button">
</FORM>

can u tell me where i am doing mistake. or what would be the correct path then

Naina
  • 211
  • 1
  • 4
  • 14

1 Answers1

0

When you say "http://Integration", "http" is the scheme. Replace it with your scheme. action=Integration://whatever

Rajesh
  • 15,506
  • 7
  • 41
  • 94
  • ok. Do i have to pass any parameters where u have written whatever? – Naina May 16 '12 at 07:46
  • Giving an error. the webpage at http://Integration/? might be temporarily down or it may have moved permanently to a new web address. – Naina May 16 '12 at 07:48
  • Please refer to this answer http://stackoverflow.com/a/2958870/1321873 which correctly explains the usage. Can you please post the code that you have used? – Rajesh May 16 '12 at 07:50
  • Can you please check if the scheme is working in a link (an anchor tag) first? – Rajesh May 16 '12 at 07:59
  • http://Integration on button click is not working.. Can u tell me if i am passing a path on button click. How the browser will identify it is android app path?? i think it is checking a web address.When i am replacing http://Integration with other google.com and other site address then it is working.otherwise not – Naina May 16 '12 at 08:22
  • ok finally it is giving index out of bound exception error while opening an app. the code in activity i have written Uri data = getIntent().getData(); String scheme = data.getScheme(); // "http" String host = data.getHost(); // "twitter.com" List params = data.getPathSegments(); // String first = params.get(0); // "hello" System.out.println(scheme); //System.out.println(first); and onAction ACTION="Integration://hello". please tell me what is the mistake – Naina May 16 '12 at 08:57
  • 1
    When you specify `Integration://hello", you have only host part, and no path and hence the `IndexOutOfBoundsException`. If you specify `Integration://hello/path/`, you will receive "path" in `first`. – Rajesh May 16 '12 at 11:19
  • yeah finally my code works here is the answer http://stackoverflow.com/questions/10615319/taking-uri-data-through-intent-in-android/10615397#10615397 – Naina May 16 '12 at 11:39