Android Question Fake GPS programmatically (B4A)

Douglas Farias

Expert
Licensed User
Longtime User
Hi all.

One of my clients asked me for a fake GPS app, I've never used similar apps ...

I already used normal GPS to get latitude and longitude, but never needed to set a latitude and longitude FAKE.

I found an example on stackoverflow and would like to know if there is anything (simplified) in B4A to do the gps fake, just passing lat and long.

https://stackoverflow.com/questions/38251741/how-to-set-android-mock-gps-location

Any help is welcome :)

Thank You!
 

DonManfred

Expert
Licensed User
Longtime User
@Douglas Farias If the old lib does not work i maybe can help.

At least i have a fake gps running on my device using a wrap i wrote this morning.

I extended the fusedlocationprovider example and added a mock location.

As of now it crashes if you set a mock location if your app is not set as application for mock. I don´t know how to check or which intent to start do check it programatically as of now. But it works if i manually add my app in the systemsetting.

Edittoadd: it is now only active when i run my app (and show a google map inside my app).
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
@Douglas Farias If the old lib does not work i maybe can help.

At least i have a fake gps running on my device using a wrap i wrote this morning.

I extended the fusedlocationprovider example and added a mock location.

As of now it crashes if you set a mock location if your app is not set as application for mock. I don´t know how to check or which intent to start do check it programatically as of now. But it works if i manually add my app in the systemsetting.

Edittoadd: it is now only active when i run my app (and show a google map inside my app).

Very good!
Can you tell me if it works with your application running in the background?

Maybe a service running in the background with a fixed notification?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Can you tell me if it works with your application running in the background?

Maybe a service running in the background with a fixed notification?
it will work if you have a running service with a timer or however you want to update the locastion (you also can set a new location).

I dont know what the result is when your app is in background. Don´t know it google maps (the app) is using the fake position or not.
 
Upvote 0

Ilya G.

Active Member
Licensed User
Longtime User
it will work if you have a running service with a timer or however you want to update the locastion (you also can set a new location).

I dont know what the result is when your app is in background. Don´t know it google maps (the app) is using the fake position or not.

Can you please share this lib?
 
Upvote 0

MbedAndroid

Active Member
Licensed User
Longtime User
 
Upvote 0
Top