Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching Android Application from link or email

I have been trying to launch the application from a link on email or from a posting on some social networking websites. The problem is that in some device or some gmail application on the android don't show the anchor tags or link that I have specified.

The intent-filter that I set to my activity is below:

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

And I am sending the email with this anchor tag

myappname://processtobedone/?id=1

It works fine with the email application that I have on Huawei device but in device's default gmail application it is not showing it has an link and in some devices by default it appends https: as suffix for the tag and launches the browser.

like image 439
Dinash Avatar asked Feb 19 '13 14:02

Dinash


2 Answers

Instead of using a custom scheme, you can have an <intent-filter> that identifies a URL that you control:

<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:host="www.this-so-does-not-exist.com"
        android:path="/something"
        android:scheme="http"/>
</intent-filter>

Then, links to http://www.this-so-does-not-exist.com/something will bring up your app (in a chooser, along with the Web browse) on devices that have your app, and will bring up your Web page on devices that do not have your app.

like image 62
CommonsWare Avatar answered Oct 22 '22 05:10

CommonsWare


Make a real link (http:) that goes a website you control, such as a static website on amazon s3, use the javascript on that site to detect an android user agent and then redirect to a link with the anchor tag.

like image 37
CQM Avatar answered Oct 22 '22 05:10

CQM