If you are enrolled in and regularly make use of Google Now, you might have seen the 'where I parked my car' card. This additional card is displayed whenever Google thinks you have stopped driving and left your vehicle.
I don't drive on a regular basis, rather 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're quick enough – the card can be used to find your bike again (unless it's been stolen).
With my incoming trip to China, I realized that Google services won't be helping me in my daily life. China blocks Google. So of course, that means no more Google Now as well. If you are lucky enough to go traveling where Google can't go or you are simply not a fan of Google Now, you might be interested in replicating the profile below. If not, you can always scroll to the bottom to download and import the project file.
This project was initially created by Mishaal Rahman, but through discussion, experimentation, and collaboration was later expanded upon by myself.
Dude, where's my car? Save my Parking Spot
This profile is fairly simple. In my set up, I've made it so I can save my parking spot using a desktop widget. If however you prefer to use voice activation or a notification button, I have provided instructions below for those cases. In any case, when the profile is activated, the location is stored in a variable and recalled when needed.
It's good to point out that Android does a pretty decent job of managing your location access to ensure minimal battery drain, but if you prefer to keep your location services disabled you have to enable location services so Tasker can get a location fix. The more location services you have enabled the quicker the fix.
By default, Android will check for your location using GPS, mobile data, and WiFi in the 'High Performance' mode. If you always leave location services on, move on to the next part. Otherwise, you can toggle location with the below run shell action in Tasker (requires root).
settings put secure location_providers_allowed=gps,network,wifi
Alternatively, you can use the Secure Settings plug-in to toggle these (here is how to make Secure Settings work on Android Nougat). Finally, for those of you without root access, if you grant the SECURE_SETTINGS permission to AutoTools you can then toggle location using that plug-in.
Save the location
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 a few things I want to do before getting the location fix. Because most of the time %LOC (Tasker's global location variable) will have a value assigned to it already (last location 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 an error or a timeout, I need to clear the existing warning notification with the Notify Cancel action.
Notifications (A5,A7)
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 this notification. We will use this name to trigger the Return Location profile later. If a location fix is not made, or the coordinates are the same as before the Get Location action, we want to display a warning with an option to re-run the same task again (Action Perform Task assigned as a button).
Button (A6,A8)
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 Tasker 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 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 Icon collection, as you can find the one that suits you and quickly provide its color alternatives.
I have labeled the actions to show which one corresponds with fail/success outcomes. The IF condition %LastLoctation = set/not-set determines that outcome.
Return the location
Return 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%3AMaterial-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 necessary 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
Return to Location profile
Profile: Return To Location Event: Notification Click [ Owner Application:* Title:Location Saved ] Enter: ReturnLocation
Now that we've set our car's location, we will create a profile that is triggered when we manually request our car's location at a later time. To trigger this task from the notification we created earlier, create an event Notification Click and add the name of the notification created earlier (Location Saved)
You now have a complete profile ready.
Using Voice Commands
AutoVoice profile
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 to save your parking spot location, create a profile using the AutoVoice Recognized event. Fill the input 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 AutoVoice Recognized event, and link it to the ReturnLocation Task.
Conclusion
It is easy to assume that everyone has access to the same resources, but this is not often the case. Should you find yourself needing a simple way to save your parking spot without relying on Google services – or you simply prefer avoiding Google services entirely, this project is for you.
This project can also be modified and used for other purposes, unlike Google Now's parking card, so see if you can come up with something better. You can also experiment with AutoNotification to make the notifications more pretty or more interactive. I kept the entire project close to the vanilla Tasker experience (apart from using AutoVoice).
Download the project here!In order to import a Tasker project file, download the above file and save it anywhere in your internal storage. Open up Tasker and check to make sure that "beginner mode" is disabled in the preferences menu. Then, long-press on the "home" icon in the bottom left hand corner and click on "import". Find the prj.xml file you saved earlier, and select it to import it. You will now see a new tab in the bottom row containing all of the profiles and tasks we referenced in this article.
We hope you enjoy this little creation of ours, and let us know if you think we can make any enhancements!
from xda-developers http://ift.tt/2j6zaF2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire