这就是我启动谷歌地图的方式。现在我想检测用户何时到达目的地。
String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?daddr=%f,%f (%s)", drplat, drplong, getAddresss(drplat, drplong));
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setPackage("com.google.android.apps.maps");
try
{
context.startActivity(intent);
}
catch(ActivityNotFoundException ex)
{
try
{
Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(unrestrictedIntent);
}
catch(ActivityNotFoundException innerEx)
{
Toast.makeText(context, "Please install a maps application", Toast.LENGTH_LONG).show();
}
}
最佳答案
您可以使用LocationManager
类,特别是它的addProximityAlert
成员函数。您指定的 PendingIntent
将在每次手机进入或离开由所提供的位置和半径定义的区域时触发。
关于android - 如何检测用户何时到达 Google map 中的目的地?我正在通过我的应用程序的 Intent 启动 Google map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54849173/