I f 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?
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 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.
Save the location
LocCar Abort Existing Task A1: Variable Clear [ Name:%LastLocation Pattern Matching:Off ] A2: Notify Cancel [ Title:Location Issue Warn Not Exist:Off ] A3: Get Location [ Source:Any Timeout (Seconds):20 Continue Task Immediately:Off Keep Tracking:Off Continue Task After Error:On ] A4: Variable Set [ Name:%LastLocation To:%LOC Recurse Variables:Off Do Maths:Off Append:Off ] A5: Notify [ Title:Location Saved Text:Tap to Navigate Icon:hd_location_place Number:0 Permanent:Off Priority:5 ] If [ %LastLocation Set ] A6: Set Widget Icon [ Name:LocCar Icon:content://com.android.externalstorage.documents/document/ primary%3AMaterial-Icons-010317-032209%2Fres%2Fdrawable-xxxhdpi%2Fic_car.png ] If [ %LastLocation Set ] A7: Notify [ Title:Location Issue Text:Im sorry location could no be set. Icon:hd_aaa_ext_car Number:0 Permanent:Off Priority:5 Actions:(1) ] If [ %LastLocation !Set ] A8: Set Widget Icon [ Name:LocCar Icon:content://com.android.externalstorage.documents/document /primary%3AMaterial-Icons-010317-032710%2Fres%2Fdrawable-xxxhdpi%2Fic_car.png ] If [ %LastLocation !Set ]
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.
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.
Return the location
ReturnLocation A1: Send Intent [ Action:android.intent.action.VIEW Cat:None Mime Type: Data:google.navigation:q=%LastLocation&mode=w Extra: Extra: Extra: Package:com.google.android.apps.maps Class: Target:Activity ] A2: Set Widget Icon [ Name:LocCar Icon:content: //com.android.externalstorage.documents/document/primary%3 AMaterial-Icons-010317-032200%2Fres%2Fdrawable-xxxhdpi%2Fic_car.png ] A3: Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ] A4: Variable Clear [ Name:%LastLocation Pattern Matching:Off ]
The task is very simple. We will run a Google Maps intent which will contain a location link:
Action:android.intent.action.VIEW Data:google.navigation:q=%LastLocation&mode=w Package:com.google.android.apps.maps Target:Activity
Our location global variable will supply the needed coordinates. Once this is done, we just need to clean up the variable (please add a wait action) and change the color of the widget icon to white.
Profile: Return To Location
Profile: Return To Location Event: Notification Click [ Owner Application:* Title:Location Saved ] Enter: ReturnLocation
To trigger this task from the notification create an event Notification Click and add the name of the notification created earlier (Location Saved)
You have a complete profile ready.
Linking the AutoVoice
Profile: Save Location Event: AutoVoice Recognized [ Configuration:Easy Commands: save my location,save this location, save my parking spot,save this parking spot, remember my parking spot,remember my location, mark this location,mark this spot,mark this parking spot Responses: okay i'll save your parking spot ] Enter: LocCar
Should you wish to add a voice trigger, create an event AutoVoice Recognized profile. And fill them with the potential spoken commands that you would use, separated by commas. If you wish to hear the response – include one in the Responses menu. Once this is done, link this with the LocCar task created earlier.
If you wish to use an AutoVoice command to find your saved location as well. Create a new event AV recognized, and link it to the ReturnLocation task.
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.