如何以编程方式关闭 Google 导航?
我通过 Intent 启动 Google 导航:
private static final int GOOGLE_NAV = 5;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q= some + address"));
startActivityForResult(intent,GOOGLE_NAV);
然后检查用户是否通过 LocationListener 到达目的地。如果用户已经到达,我想关闭 Google 导航活动。
if(hasArrived())
{
finishActivity(GOOGLE_NAV);
}
但是,我的代码似乎不起作用。
I am starting Google Navigation through an Intent:
private static final int GOOGLE_NAV = 5;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q= some + address"));
startActivityForResult(intent,GOOGLE_NAV);
I then check if the user has reached his destination via a LocationListener. If the user has arrived, I want to close the Google Navigation activity.
if(hasArrived())
{
finishActivity(GOOGLE_NAV);
}
However, my code doesn't seem to work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论