I would like to have another feature where it stores the previous location of the user after pressing the Update Location Button and getting the current location as well
Not really, it doesnt really save the previous location and can only work when the app is closed. I have Firebase on this app so that might work. Is there a code in Firebase that if the data changes, instead of overwriting it, it saves to another branch or data? Are there any ways that I can use?
Closed??? the example only works when the app is open (to work when the app is closed you need to use a Background extension). The example requires manual intervention. It can be coded to work automatically.
Sorry I meant open. Anyways I made a sort of prototype thats based on the example. The app is almost the same but it still isnt working the way I want. Here is the premise:
You open the app and when the screen initializes, it will get the lat and long in Prev Slot, if you had used it before it will show the last lat and long stored before in Prev Slot as well.
If you click Update, it will get new lat and long and show it in the New Slot. Anything lat and long that was previously there will be stored into a TinyDB and put into the Prev Slot, making them Prev lat and Prev long
The app doesnt do this and instead doesnt change. Everytime I open it or press the button, it will give lat and long, but the Prev Slot would be the same as the New Slot. What should I change in the coding here? SaveGPS.aia (3.7 KB)
It is Android ver 6, but that doesnt really affect my app. the sensor is accurate with giving me the data. My problem is that it doesnt save previous data to my Prev Slot and just gets the data I got when I update it
The idea is like a Ball Sorting Algorithm with two ends of it. One goes in and the other goes out. In this case new data goes in the new and the old goes in the Prev.
When the app is started you load the last set of lat/lon values, when location changed you load the penultimate set (because the new location is the current set. This means after an app restart and the first location change, the prev values will be the same)