3
目前,我正在开发一个将位置注入Android的应用程序。此应用程序应该在特定时刻注入位置。之前和之后,应该使用普通的GPS。如何停止测试位置提供者
我的软件能够切换到模拟位置并成功注入位置。但我无法让Android再次听到正常的GPS。
我的代码来设置:
mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
mLocationManager.addTestProvider(LocationManager.GPS_PROVIDER, false, false, false, false, true, true, true, 0, /*magic*/5);
mLocationManager.setTestProviderEnabled(LocationManager.GPS_PROVIDER, true);
我没有试图阻止:
mLocationManager.setTestProviderEnabled(PROVIDER_NAME, false);
mLocationManager.removeTestProvider(PROVIDER_NAME);
我的问题:如何停止提供模拟地点和恢复默认的Android GPS?
那么解决方案什么都不做?只是不发送新的测试位置? – user1940676 2014-01-06 14:14:43
不,它在注册新的位置侦听器后再次运行。然后,真实的GPS将再次用于位置更新。 – Jordi 2014-01-08 23:53:00