Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
93 views
in Technique[技术] by (71.8m points)

android - How to mock location on device?

How can I mock my location on a physical device (Nexus One)?

I know you can do this with the emulator in the Emulator Control panel, but this doesn't work for a physical device.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It seems the only way to do is to use a mock location provider.

You have to enable mock locations in the development panel in your settings and add

   <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> 

to your manifest.

Now you can go in your code and create your own mock location provider and set the location of this provider.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...