diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-05-04 04:38:12 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-05-04 04:38:12 +0200 |
commit | 2582ece2105f98a7a20d72d8c8dc70772a48286f (patch) | |
tree | 580fb5aed78e37478ab83842c9715dedb51b7566 /src | |
parent | 7415c8f3b3128a4b5d7a47a4a6304492f9d62cc0 (diff) |
open market if share location plugin isn't installed
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index a76efbc3..349d8ffe 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -409,6 +409,7 @@ public class ConversationActivity extends XmppActivity public void onPresenceSelected() { Intent intent = new Intent(); boolean chooser = false; + String fallbackPackageId = null; switch (attachmentChoice) { case ATTACHMENT_CHOICE_CHOOSE_IMAGE: intent.setAction(Intent.ACTION_GET_CONTENT); @@ -436,6 +437,7 @@ public class ConversationActivity extends XmppActivity break; case ATTACHMENT_CHOICE_LOCATION: intent.setAction("eu.siacs.conversations.location.request"); + fallbackPackageId = "eu.siacs.conversations.sharelocation"; break; } if (intent.resolveActivity(getPackageManager()) != null) { @@ -446,12 +448,25 @@ public class ConversationActivity extends XmppActivity } else { startActivityForResult(intent, attachmentChoice); } + } else if (fallbackPackageId != null) { + startActivity(getInstallApkIntent(fallbackPackageId)); } } }); } } + private Intent getInstallApkIntent(final String packageId) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("market://details?id="+packageId)); + if (intent.resolveActivity(getPackageManager()) != null) { + return intent; + } else { + intent.setData(Uri.parse("http://play.google.com/store/apps/details?id="+packageId)); + return intent; + } + } + public void attachFile(final int attachmentChoice) { switch (attachmentChoice) { case ATTACHMENT_CHOICE_LOCATION: |