Android Question GPS spoofer

Similar threads

B4A Tutorial GPS tutorial
B4A Tutorial [java] Creating libraries for B4A
B4A Library DJI Drones
B4A Tutorial Gnss Status Updates
B4A Question Get Latitude and Longitude with Wifi

carlos7000

Active Member
Licensed 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.
 

MarkusR

Well-Known Member
Licensed 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:

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.
 

carlos7000

Active Member
Licensed 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.
 

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
 
Top