-1

I've seen in some application like Waze - GPS Navigation and Facebook app have a protocol that when the user surf to a waze:// site, it opens the Waze app with a given location.

For example:

When i have Waze installed in my phone and i'm surfing to:

waze://?ll=<lat>,<lon>

The Waze application will automatically opens and center my map to lat,lan location.

How can i make and register a protocol to my own app that will use syntax like

`myApp://command` 

and will open my application with a given parameters ?

Swayam
  • 16,294
  • 14
  • 64
  • 102
Asaf Nevo
  • 11,338
  • 23
  • 79
  • 154
  • As far as registering custom intents goes, see http://openintents.org – Edward Falk Jun 18 '13 at 22:09
  • @CommonsWare - is it posiible to make a schema that incase the user doesn't have the app it will send him to download in the Google's market ? – Asaf Nevo Jun 19 '13 at 12:16
  • If you want you app beeing compatible with other apps you should also look at [openintents-uris](http://www.openintents.org/en/uris). Additional to @EdwardFalk-s comment this site also defines uri schema . There are already uris for "geo:" and "google.navigation:ll=latitude,longitude" – k3b Jun 19 '13 at 13:34

1 Answers1

1

is it posiible to make a schema that incase the user doesn't have the app it will send him to download in the Google's market ?

No.

You are welcome to use an HTTP URL as your "custom protocol":

        <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>

This <intent-filter> will match http://www.this-so-does-not-exist.com/something. If your app is not installed, the user will view this in a Web browser. However, if your app is installed, the user might still elect to view this in a Web browser, rather than choose your app from the chooser.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491