GPS stays on using Intent call

纵饮孤独 提交于 2020-01-24 00:48:18

问题


I have a quick behavior question. When I call the following lines of code:

String currURL = "http://maps.google.com/maps?saddr="+nLocation.getLatitude()+","+nLocation.getLongitude()+"&daddr=110+Possum+Hollow+Road,+Newark,+DE+19711+(Tri-State+Bird+Rescue)&hl=en&ll=AnotherLat,AnotherLong&spn=0.28323,0.683212&sll=AnotherLat,AnotherLong&sspn=0.283147,0.683212&geocode=FcejYQIdRnCE-w%3BFXn_XQIda4F8-yF_tbhhHBmAIw&vpsrc=0&mra=pd&z=11";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(currURL));
App.this.getParent().startActivity(browserIntent);

It seems to keep the GPS on. Is there something wrong in what I was doing?

Thanks! Jon


回答1:


If you requested location updates, then you must do removeUpdates(locationListener) So, right before doing startActivity, you might want to removeUpdates




回答2:


If you are using an embedded MapView with a MyLocationOverlay, you need to explicitly clean up/disable this resource using MyLocationOverlay.disableMyLocation(), when your MapView closes. Because these individual overlays request for a location for themselves, and this can leave the GPS unit switched on, with the GPS icon flashing in the Status Bar.

Source: https://groups.google.com/d/msg/android-developers/SmiBz--6COc/blu9Bhkrt1QJ



来源:https://stackoverflow.com/questions/7374720/gps-stays-on-using-intent-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!