Reputation: 967
I am developing a hybrid android application by using phonegap. I want to navigate to maps by using the following code:
<a href="geo:32.5558485,34.65522447"></a>
How can I discover if the google map application is installed in the device. by HTML and/or javascript only.
Thanks in advance
Kobi
Upvotes: 0
Views: 570
Reputation: 23273
You shouldn't need to as when you click on that link Android will give you a list of apps that can handle the geo: url type.
If you really want to check if there is an app available to handle that URI scheme you'll need to write a plugin to call some Java code:
public static boolean isIntentAvailable(Context context) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:32.5558485,34.65522447"););
List<ResolveInfo> list =
packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
Upvotes: 2