0

Will it be possible, if I have a button in a website and and when clicked, it will do a trigger function and a related App will open automatically in an Android device? In iPhone it is getting possible. Thanks

Abhisheksry
  • 49
  • 1
  • 3

3 Answers3

1

From a previous Stack Overflow Question:

Launch custom android application from android browser

Namely:

Use an <intent-filter> with a <data> element. For example, to handle all links to twitter.com, you'd put this inside your <activity> in your AndroidManifest.xml:

<intent-filter>
    <data android:scheme="http" android:host="twitter.com"/>
    <action android:name="android.intent.action.VIEW" />
</intent-filter>

Then, when the user clicks on a link to twitter in the browser, they will be asked what application to use in order to complete the action: the browser or your application.

Of course, if you want to provide tight integration between your website and your app, you can define your own scheme:

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

Then, in your web app you can put links like:

<a href="my.special.scheme://other/parameters/here">
Community
  • 1
  • 1
Vicente Plata
  • 3,370
  • 1
  • 19
  • 26
  • 1
    Please note that hackbod presents a decent argument for not doing this in http://stackoverflow.com/questions/3469908 – Thane Anthem May 10 '11 at 08:37
0

It is possible: you need to register a URL handler in your app.

EDIT: see How to listen for a custom URI for details.

Community
  • 1
  • 1
Femi
  • 64,273
  • 8
  • 118
  • 148
  • Please note that hackbod presents a decent argument for not doing this in http://stackoverflow.com/questions/3469908 – Thane Anthem May 10 '11 at 08:37
  • It is a decent argument: I personally like the http argument, as it covers cases where your app isn't installed. Personal choice, though, I have to say. – Femi May 10 '11 at 12:58
  • I find it annoying to not be able to click market:// links in my main computer's web browser. – Thane Anthem May 10 '11 at 16:08
  • hehehe: someone should release a set of browser plugins to translate market links back into http links. – Femi May 10 '11 at 17:14
  • A few do exist for chrome. http://www.google.com/search?q=android+market+links+from+chrome – Thane Anthem May 10 '11 at 17:40
0

It's also possible to launch an Android app from a web browser that's not on the device.

Take a look at Chrome to Phone for an example.

http://code.google.com/p/chrometophone/

Thane Anthem
  • 4,093
  • 4
  • 26
  • 24