Reputation: 15128
Hi i have tried so much to open custom app from url, but i failed , i have this link to open custom app click here
as per link i have done coding, my coding is below
AndroidManifest.xml file....
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".AnimatedScreen"
android:label="Last Alert Pro"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MapInfo"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<activity
android:name=".MapInfo"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<data android:scheme="my.lastalertpro.scheme" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
</activity>
Now in coding part html link in browser is like below
String linkForAndroid = "my.lastalertpro.scheme//" + lon + "/" + lat + "/" + alt;
Now i in Java part the coding for fetching data is
Uri data = getIntent().getData();
String scheme = data.getScheme(); // "http"
if (scheme != null) {
String host = data.getHost(); // "my.lastalertpro.scheme"
List<String> params = data.getPathSegments();
try {
lon = Double.parseDouble(params.get(0)); // longitude
} catch (Exception e) {
lon = 0.0;
}
Now the problem is that i am getting this link in gmail. when i got mail and try to click on this link the browser list is not displaying and also application is started directly in default browser :(
Upvotes: 0
Views: 1518
Reputation: 15128
Finally i found the answer
if you send below link in gmail...
String linkForAndroid = "my.lastalertpro.scheme//" + lon + "/" + lat + "/" + alt;
Do not know why but it's considered like this way in ANDROID PHONE ---NOT--- ON DESKTOP COMPUTER
in mail if you got link and click on this the link will be looking like
http://my.lastalertpro.scheme/70.77188993/22.28305819/96+m.
so you have to pass intent-filter in AndroidManifest.xml file like this way
<intent-filter>
<data android:scheme="http" android:host="my.lastalertpro.scheme" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
Upvotes: 3
Reputation: 408
Try adding the given below tags along with action_view
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
Upvotes: 0