Save location with Tasker, retrieve it later

If you are using Google Now, you are aware of the ‘where I parked my car’ card. The additional card is displayed (needs to be enabled in settings) whenever Google thinks you have stopped driving, and abandoned the vehicle. I don’t drive on a regular basis, I cycle everywhere and I find it very flattering each time Google serves me this card. It proves that Google doesn’t know everything about us just yet, but if you quick enough – the card can be used to find your bike again. Sadly not when it’s stolen.
With the incoming trip to China, I realized that Google services won’t be helping me in my daily life. China blocks their servers. If you are lucky enough to go traveling where Google can’t go, or if you simply prefer other than stock launcher, you might be interested in the replicating the profile below. The project has been suggested to me by Mishaal Rahman from xda-developers.com so thanks to him for that.

Dude, where’s my car?

The profile is fairly simple. I’m going to use AutoVoice or a widget button to save the location. A widget will provide us with a feedback. You will be able to navigate back to saved location via notification or a voice command.

It’s good to point out, that the Android does a pretty decent job at managing your location, but if you prefer to keep your services disabled – you have to enable the location services before getting the value of the %LOC variable. The more location services you have enabled the quicker the fix. By default, Android will check the GPS, mobile data, and WIFI. If you already toggle these – you know what to do, if you are happy with the way the Android works – just leave it on. Otherwise, use AutoTools or the run shell action:

settings put secure location_providers_allowed=gps,network,wifi

Secure Settings also can also be used to toggle these (here is how to make the Secure Settings enabled). For the sake of this tutorial, I will show you how to use both, a widget and voice command trigger.

Getting location (A1-A4)

There are few things I want to do before getting the location set. Because most of the time %LOC will have a value assigned already (last fix) I only want to use the location coordinates requested through the profile. I will use the global variable %LastLocation to store these coordinates. If the task has been run again due to error or a timeout, I need to clear existing warning notification with the Notify Cancel.

Notifications (A5,A7)

Success

Fail

There are two outcomes of the Get Location action. We will end up with a new set of coordinates, or the action will fail to acquire the coordinates. If the fix is found, a notification will be displayed. Note the name of it. We will use this name to trigger the Return Location profile later. If the fix is not found, we want to display a warning with an option to rerun the same task again (Action Perform Task assigned as a button).

Button (A6,A8)

Default

Success

Fail

I mentioned earlier that there will be a button; which will change the color to show us a state of our parking profile. Color codes are:

white (ready)

red (fail)

green (armed)

All you need is a widget (not the shortcut) placed on your home screen for the task which will save the location. Make sure to assign an icon to this task to be able to add a task shortcut from the widget screen. I’m using this instead of the shortcut as I get the Tasker to change the color of the icon according to the current state.
One of my favorite ways of getting the icons is the Material Design Icons collection, as you can find the one that suits you and quickly provide the color alternatives.
I have labeled the actions to show which one correspond with fail/success outcomes. The IF conditions %LastLoctation = set/not-set determines that outcome.

Conclusion

It is easy to assume, that everyone has an access to the same as me resources, but this is not often the case. This project can be modified and used for other purposes, and unlike Google Now parking card, it’s not dependent on google services. You can also experiment with AutoNotification to make the notifications prettier or more interactive. I kept the entire project close to Tasker vanilla experience (apart from AV).

You could also create an array what would store more notification at once, or do something interesting with a collection of these points on the map. Let me know if the project inspires you – I’m always happy to look at the reader’s projects.

Share this:

About the Author

I am passionate about technology, cycling, and art. This would explain why my bike has more computing power than your average office. I own notenoughtech.com and I write for xda-developers.com and pocketables.com
Feel free to follow me!