I'm doing a simple Android application. This application would have to show a GPS route provide from the mock GPS of the emulator. I have read the Android documentation and this forum and I try do it with an IntentReceiver. I use an example code to do this, The friend finder of plusminus, and It seems to work.
Before to do this, I used the AndroidManifest to declare the IntentReceiver class and other Java file to define the IntentReceiver class, but I was a problem that I cannot resolve. I use a Location variable to store the position read (with the function requestUpdates) from the GPS, this variable is inside the main class and the IntentReceiver class is in other class file. How can I access to this Location variable
The idea would be to send the actual position to the IntentReceiver class, read a new position and return the location but I have read that an IntentReceiver cannot return values. The only way is to declare IntentReceiver class inside the main class
This problem is resolved but I have curiosity if there is other way to do this, because all examples that I have seen use the same solution.
One question about mock GPS: There is some way to restart the mock GPS I have to close the emulator to begin from the first coordinate.