diff --git a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java index a0af6dcc..629132f1 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java +++ b/mobile/src/com/cradle/iitc_mobile/share/IntentListView.java @@ -86,6 +86,14 @@ public class IntentListView extends ListView { } } + private static final HashSet GEOLABEL_WHITELIST = new HashSet(); + + static { + if (GEOLABEL_WHITELIST.isEmpty()) { + GEOLABEL_WHITELIST.add("com.google.android.apps.maps"); + } + } + private HashMap mActivities = new HashMap(); private IntentAdapter mAdapter; @@ -164,6 +172,16 @@ public class IntentListView extends ListView { ResolveInfo info = activityList.get(i); ActivityInfo activity = info.activityInfo; + // remove all apps that don't support a geo intent like geo:0,0?q=lat,lng(label) + // they'll receive a default geo intent like geo:lat,lng + if (intent.getData() != null && + "geo:0,0?q=".regionMatches(false, 0, intent.getData().toString(), 0, 10) && + !GEOLABEL_WHITELIST.contains(activity.packageName)) { + activityList.remove(i); + i--; + continue; + } + // fix bug in PackageManager - a replaced package name might cause non-exported intents to appear if (!activity.exported && !activity.packageName.equals(packageName)) { activityList.remove(i); diff --git a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java index ffae8ae7..c6bded02 100644 --- a/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java +++ b/mobile/src/com/cradle/iitc_mobile/share/ShareActivity.java @@ -66,13 +66,17 @@ public class ShareActivity extends FragmentActivity implements ActionBar.TabList private void setupIntents() { setupShareIntent(getUrl()); - // we merge gmaps intents with geo intents since it is not possible - // anymore to set a labeled marker on geo intents + // gmaps supports labeled markers via geo intent...most other navigation apps don't + // so provide two different geo intents and filter them in IntentListView ArrayList intents = new ArrayList(); String gMapsUri; try { + /* + * doesn't work anymore since gmaps v7.6.1 gMapsUri = "http://maps.google.com/?q=loc:" + mLl + "%20(" + URLEncoder.encode(mTitle, "UTF-8") + ")&z=" + mZoom; + */ + gMapsUri = "geo:0,0?q=" + mLl + "%20(" + URLEncoder.encode(mTitle, "UTF-8") + ")"; } catch (UnsupportedEncodingException e) { gMapsUri = "http://maps.google.com/?ll=" + mLl + "&z=" + mZoom; Log.w(e);