【问题标题】:Is there a way to make a generic intent with GPS coordinates?有没有办法用 GPS 坐标制作通用意图?
【发布时间】:2012-12-22 09:33:03
【问题描述】:

在我的应用程序中,当我点击一个地方时,我想触发 Intent Chooser 让用户使用 GPS 坐标进行游戏...

我希望让用户可以在 Google 地图、导航、街景或任何已安装的 GPS 之间进行选择......

到目前为止,这些应用程序中的每一个都可以以不同的意图启动......例如:

导航:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" +mLat+","+mLong));

谷歌地球:

Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("geo:"
+ "?q="
+ e.latitude
+ ","
+ e.longitude)));

谷歌地图:

Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("geo:"
+ e.latitude
+ ","
+ e.longitude
+ "?q="
+ e.latitude
+ ","
+ e.longitude)));

街景:

不同的东西

导航:

<action android:name="android.intent.action.navigon.START_PUBLIC" />
Location coordinates.
String INTENT_EXTRA_KEY_LATITUDE = "latitude";
String INTENT_EXTRA_KEY_LONGITUDE = "longitude";

任何 GPS 应用:

有没有办法为所有这些应用使用单一意图并让用户选择?

【问题讨论】:

    标签: android android-intent location


    【解决方案1】:

    有没有办法为所有这些应用使用单一意图并让用户选择?

    大概不会。欢迎您使用PackageManagerqueryIntentActivities() 来构建您自己的选择器,它结合了各种Intent 对象的结果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-15
      • 1970-01-01
      • 2022-12-22
      • 2012-09-21
      • 1970-01-01
      相关资源
      最近更新 更多