Bhu*_* BS 8 navigation android google-maps android-intent
我从我的应用程序启动Google Map以将用户导航到某个位置.
这是我的代码.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q=" + rideDetailsModel.getEndLatitude() + "," + rideDetailsModel.getEndLongtitude()));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
我正在使用像Uber驱动程序应用程序这样的Chat Head从Google Map收回我的应用程序.这工作正常.问题是,当我调用上面相同的代码时,Google Map要求我退出上一个导航.因为之前的导航未被清除.
如何强制Google地图创建新导航而不要求关闭上一个导航.
两种方法可以解决我的问题.
方法1
如果我可以从我的应用程序关闭Google地图应用程序,我的问题就解决了 但我搜索了很多,非根电话无法杀死其他应用程序.
方法2
清除上一个导航并创建新导航.因此,Google地图不会要求用户在开始新导航之前退出上一个导航.
小智 4
方法3:(只需清除意图标志即可实现)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
329 次 |
最近记录: |