LocationManager.addTestProv开发者_开发问答ider() gives an easy way to mock the location. However, in this case, LocationManager.getGPSStatus() still returns empty data and this can cause software to think that there is no GPS signal. Is there a way to control the data which is returned by getGPSStatus()?
Create an adapter around LocationManager. Have this API adapt, aka work the way you want. Easier to mock plus you can control what you return each time.
精彩评论