Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I launch my app via a custom URL in an email

Tags:

android

url

email

I'm adding a custom URL using the android:scheme in my intent filter as follows

  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="myscheme" android:host="myhost" />
  </intent-filter>

I'm sending the phone an email with the following in the contents:

myscheme://myhost?data=whatever

but the above link shows up as plain text, i.e. not as a link.

like image 941
Russell Mitchell Avatar asked Mar 10 '11 20:03

Russell Mitchell


People also ask

How do I run an app from a URL?

First of all you need to add intent filters for incoming links. Specify the ACTION_VIEW intent action so that the intent filter can be reached from Google Search. Add one or more tags, each of which represents a URI format that resolves to the activity. At minimum, the tag must include the android:scheme attribute.

What is a custom app URL?

Custom URL schemes provide a way to reference resources inside your app. Users tapping a custom URL in an email, for example, launch your app in a specified context. Other apps can also trigger your app to launch with specific context data; for example, a photo library app might display a specified image.

Where is the app URL scheme?

Go to the Play store, find the app and view its page. Copy the URL from the browser address bar. Make a note of this as the "Android Fallback URL." You'll see a parameter called "id" followed by an equal sign (=).


2 Answers

You need to send your email in HTML, with your link in an <a> tag:

<a href='myscheme://myhost?data=whatever'>Launch

App

Automatic link parsing is almost certainly only done with links starting with http:// or www., and it varies from email client to email client anyway.

Ok, I tried that and it didn't work. The only solution I can offer is to actually use http:// with a link going to your site, to a specific app page, with the same GET parameters. You can register an intent-filter to intercept this with the app and handle it appropriately, and if the user doesn't have the app, the web page instructs them to install it.

like image 136
fredley Avatar answered Oct 09 '22 21:10

fredley


Link to your website and then redirects to "myscheme://myhost?data=whatever"

like image 43
Jonas Alves Avatar answered Oct 09 '22 21:10

Jonas Alves