Mock GPS location issue

微笑、不失礼 提交于 2019-11-30 23:57:36

Problem solved: I added the following code to set my current location and it can successfully show up in google map application.

location.setLatitude(latitude);
location.setLongitude(longitude);
location.setBearing(bearing);
location.setSpeed(speed);
location.setAltitude(altitude);
location.setTime(new Date().getTime());
location.setProvider(LocationManager.GPS_PROVIDER);
location.setAccuracy(1);

Conclusion: If you want to use mock location service in the new version of android, you have to set every attribute by yourself.

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