Android Question GPS spoofer

carlos7000

Well-Known Member
Licensed User
Longtime User
Hi all

How can I make a program that makes the cell phone believe that it is moving?

I am developing an application that requires the use of GPS, but to test it, I always need to go out walking streets. To make things easier, I carry a notebook, so I stop somewhere and try to correct the problem. If I develop the application at night a rainy and cold day, or in a dangerous place, it is worse.

I know there are several programs that perform this task. But the company I develop uses old equipment. Applications that simulate GPS do not run, or work erratically on such old equipment.

I could create a simple application to which 2 points are given and simulate the movement between the two at a given speed. But I have no idea where to start.
 

DonManfred

Expert
Licensed User
Longtime User
own simulation eg
how do you SIMULATE a new GPS Position to the SYSTEM? Calling a sub in your own app doesn´t change any SYSTEM-Positioning routines and this is what the TO is trying to archieve.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
my phone have a developer option to choose a app for simulating locations.
i think that app you will write,true?

https://developer.android.com
 
Last edited:
Upvote 0

emexes

Expert
Licensed User
choose a app for simulating locations
and for most everybody that would be the solution and end of discussion, but the original post stated:
... old equipment. Applications that simulate GPS do not run, or work erratically ...
and thus I am interested in what solution Carlos used, in case he has struck (programming) gold that might be used in eg testing BLE interfaces.
 
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User
A request for ACCESS_MOCK_LOCATION or WRITE_MOCK_LOCATION does not appear in runtimepermission

I tried with two versions of the manifest.

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
    )
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddPermission(android.permission.ACCESS_MOCK_LOCATION)
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
    )
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
 
Upvote 0

emexes

Expert
Licensed User
Yes, I still have to walk the streets. I still can't.
Can you post the part of your code that receives position from GPS? Just the few lines before and after the bit where you are reading the latitude and longitude into your own app's variables will be enough, eg might look like:
B4X:
Public Sub LocationChanged(Location1 As Location)
   CurrentLatitude = Location1.Latitude
   CurrentLongitude = Location1.Longitude
   LastUpdateTime = DateTime.Now
End Sub
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top