Table of contents:
Contents
Intents
An Intent provides a facility for performing late runtime binding between the code in different applications on Android platform. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.
Supported intents
Intent
Category
Applications using it
Open Navigator from menu/shortcut
LAUNCHER
System
GEO intent
DEFAULT, BROWSABLE
Contact list, c:geo
HTTP intent maps.google.com
DEFAULT
Yelp
HTTPS intent maps.google.com
DEFAULT
?
Intent category
Intent category gives additional information about the action to execute. For example, CATEGORY_LAUNCHER means it should appear in the Launcher as a top-level application, while CATEGORY_ALTERNATIVE means it should be included in a list of alternative actions the user can perform on a piece of data.
Category
Description
BROWSABLE
Activities that can be safely invoked from a browser must support this category.
DEFAULT
Set if the activity should be an option for the default action (center press) to perform on a piece of data.
EMBED
Capable of running inside a parent activity container.
HOME
This is the home activity, that is the first activity that is displayed when the device boots.
LAUNCHER
Should be displayed in the top-level launcher.
TAB
Intended to be used as a tab inside of a containing TabActivity.
How to open Navigator Intent from another application
Geo intent
To open Navigator using geo intent use following method
public void openGeoIntent(String address, float lat, float lon, boolean navigate) { String ext = navigate ? "&navigate=yes" : ""; Uri uri = Uri.parse("geo:" + Float.toString(lat) + "," + Float.toString(lon) + "?q=" + Uri.encode(address) + ext); Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri); startActivity(intent); }
Navigator geo intent can be opened using by one of variant below
Variant
Description
openGeoIntent(address, lat, lon, false)
Open position defined by the coordinates and give place name from address
openGeoIntent("", lat, lon, false)
Open position defined by the coordinates without name of place
openGeoIntent(address, 0, 0, false)
Search for address online and open returned position
openGeoIntent("", lat, lon, true)
Navigate to position defined by the coordinates without name of place
HTTP intent maps.google.com
To open Navigator using HTTP intent using the host maps.google.com use following method
public void openHttpIntent(String address, float lat, float lon, boolean navigate) { String ext = navigate ? "&navigate=yes" : ""; String host = "http://maps.google.com/maps?f=d&daddr="; Uri uri = Uri.parse(host + Uri.encode(address) + "@" + Float.toString(lat) + "," + Float.toString(lon) + ext); Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri); startActivity(intent); }
Navigator http intent can be opened using by one of variant below
Variant
Description
openHttpIntent(address, lat, lon, false)
Open position defined by the coordinates and give place name from address
openHttpIntent("", lat, lon, false)
Open position defined by the coordinates without name of place
openHttpIntent("", lat, lon, true)
Navigate to position defined by the coordinates without name of place
HTTPS intent maps.google.com
To open Navigator using HTTPS intent using the host maps.google.com use following method
public void openHttpsIntent(String address, float lat, float lon, boolean navigate) { String ext = navigate ? "&navigate=yes" : ""; String host = "https://maps.google.com/maps?f=d&daddr="; Uri uri = Uri.parse(host + Uri.encode(address) + "@" + Float.toString(lat) + "," + Float.toString(lon) + ext); Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri); startActivity(intent); }
This intent has same usage as HTTP intent.