Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,733,605 Members 43,566 Now Online
XDA Developers Android and Mobile Development Forum

[Tasker] Glasker: Send Anything to Glass with only TASKER!

Tip us?
 
lssong99
Old
(Last edited by lssong99; 12th May 2014 at 12:32 PM.)
#1  
Senior Member - OP
Thanks Meter 42
Posts: 139
Join Date: Jul 2005
Angry [Tasker] Glasker: Send Anything to Glass with only TASKER!

I have a Pebble, which doing a great job of getting Android Notifications! I just wonder if I can do the same thing with Google Glass.

There are some notification forwarder on the Market now, however, since I am already running Tasker, so I wonder if I could use

Tasker + Google's Mirror API

to achieve same thing without running any other APP on my phone, nor on my Glass, and here it is: "Glasker"

"Glasker" encapsulated Mirror API's token and authorization process into several Tasker tasks so you only need to write simple tasker "Profile" based on trigger you want then send anything to Glass!

With "Glasker", you could:
1. Forward ANY Android notification (as far as Tasker can get) to your Glass.

2. Forward Music Track info on your Phone to Glass while playing by Phone.

3. All of communications are just between your phone, Google's cloud and your Glass. Nothing go through another server.

4. You tell me!


Before we start, here are the disclaimer:
1. As Tasker is just plain text, you can see everything how those tasks works. Please review the code before proceed and once you run the tasks, I am not responsible what happened to your phone, your glass, Google's cloud or your washing machine, etc...

2. I am NOT affliated to the author of "Tasker" nor "RESTask for Tasker". Thus I am do NOT know if any of them send your message somewhere else. Don't use this project if you suspect anything.


Okay, Here are the setup steps:
0. Install a Tasker plugin "RESTask for Tasker" https://play.google.com/store/apps/d...eehaha.restask This is used to send REST message to Google's cloud. (Tasker's internal PUT doesn't work here...)

1. Setup your OAuth2.0 Client ID and Client secret at https://console.developers.google.com/project (If you have no idea on what I am saying here, I will try to add a walk thru in 3rd post when I got time!)

2. Turn on your Glass and make sure it connected to your phone via MyGlass app. Make sure your phone and Glass can access the network.

3. Import downloaded "Glass.prj.xml" file into Tasker

4. Open task "TimeInZulu" and modify Variable Substract: %deliverytime, xxxxx according to your time zone!
In Taiwan (GMP+0800), xxxxx=8*60*60=28800
In LA, USA (GMP-0800), please change Variable Substract-->Variable add: %deliverytime, 28800
Other time zone please modify as needed or you will not hear a chime when message delivered to your Glass!

5. Run Task "Get Authorization 1" once and input your Client ID, Client secret (Those two variables will be kept in Tasker Variables in PLAIN text since it will be used later), than your default browser will fire

6. After grant yourself with the priviledge of "Glass timeline request", than you will be directed to a web page with a code. Please copy the code.

7. Return to Tasker, than run "Get Authorization 2" (hence Google's Two-Step Authorization....), than input the code you get from last step.

8. Let the Task run a while (10~20 second), then you should see a message on Glass says "My Notification forwarder Setup Completed!" (If not, lease scroll to right of timeline to see this message. It should be the 1st message)

9. Now, go back to Tasker/Profile than setup your trigger. (My default trigger are with Line, a Whatsapp like messanger very popular in Taiwan)

10. Profit!

If you find this useful, Thanks button is just a click away! Also, if you can make this project better, please also share what you modified here!
Attached Files
File Type: rar Glasker.prj.rar - [Click for QR Code] (4.2 KB, 39 views)
The Following User Says Thank You to lssong99 For This Useful Post: [ Click to Expand ]
 
lssong99
Old
#2  
Senior Member - OP
Thanks Meter 42
Posts: 139
Join Date: Jul 2005
Profile explaination:
1. GlassConnected: Master switch for all sending profiles. I disable the forwarding of message if my Glass is not connected to my phone via BT directly for apparently security reason. In theory as long as both your Phone and Glass are connected to the network, you can forward message even they are at opposite side of the world!
2. SendLineMsg: Send message from Line, a Whatsapp like app wildly used in certain parts of world (4 billion active user!). You can modify this to any other messanger!
3. SendMusicInfo: Not necessary, it's just a demo to show it can send something else.

Task explaination:
1. Get Authorization 1/2: To get authorization from Google to allow access to Mirror API.
2. Remove All TimeLine Items: Utility task. As name suggests, it removes all timeline items created (only) by Glasker. It also reset several Tasker variables should you encounter problem. (No need to re-do Get Authorization)
3. Get Time Line: Used in "Remove All TimeLine Items" to get all timeline items created by Glasker
4. GetAccessToken: Utility task. Used to get new access token from Google (since token are temporarily and expires about 360 seconds). Usually you don't need to mess with this task
5. TimeInZulu: Convert local time to Zulu time. It seems Mirror API only accepts Zulu time format. (You need to modify this task based on your timezone as above step 4 or you wil not hear reminder chime when mesasge delivered
6. SendStaticCard: This task is used to send customized content to Glass.
7. SendLineMsg: Send nofication from Line app to the Glass. I update both "Boundle Cover" as will as content
8. SendMusicInfo: Send the music track info for the music playing at stock music player on your PHONE. (This is a demo of non-chimed Card send to glass)
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2014-05-12-15-29-46.png
Views:	201
Size:	171.8 KB
ID:	2739397   Click image for larger version

Name:	Screenshot_2014-05-12-15-29-52.png
Views:	168
Size:	122.0 KB
ID:	2739398  
 
lssong99
Old
#3  
Senior Member - OP
Thanks Meter 42
Posts: 139
Join Date: Jul 2005
Default Reserved

**Reserved**
 
jewnersey
Old
#4  
jewnersey's Avatar
Senior Member
Thanks Meter 74
Posts: 1,042
Join Date: Jul 2010
This looks pretty cool. Sorry if I missed it, but does glass automatically turn on, visual, for each notification?
 
lssong99
Old
#5  
Senior Member - OP
Thanks Meter 42
Posts: 139
Join Date: Jul 2005
Quote:
Originally Posted by jewnersey View Post
This looks pretty cool. Sorry if I missed it, but does glass automatically turn on, visual, for each notification?
Yes, you can make a sound when notification push to Glass. However, the Glass will not turn on the screen. (This is explicitly mentioned by Google that such ability will not be allowed in Mirror API, only for APP running on Glass itself).

What's cool here is that when you hear the notification sound, if you turn on the Glass in about 5 second (by touchpad or head-up activation), the Glass will show the notification card directly instead of the regular card with time.

The task of "SendLineMsg" is an example to have a card with notification sound, while "SendMusicInfo" doesn't have sound.
 
Frunple
Old
#6  
Junior Member
Thanks Meter 2
Posts: 21
Join Date: Apr 2008
Got any way to go the other way? From Glass to phone? Would be great for voice commands for home automation.
 
lssong99
Old
#7  
Senior Member - OP
Thanks Meter 42
Posts: 139
Join Date: Jul 2005
Quote:
Originally Posted by Frunple View Post
Got any way to go the other way? From Glass to phone? Would be great for voice commands for home automation.
Yes, it's possible to go the other way (from glass to Phone). However you need to run a HTTP server on your phone.... The whole Mirror API is two way...

I was thinking to have Tasker to enable/disable the HTTP server on phone based on the message sent (to save phone resource-->Battery when no message are needed) but don't have time to do it yet...

You are welcome to make modification here!
 
foxdog66
Old
#8  
Senior Member
Thanks Meter 43
Posts: 407
Join Date: Jul 2010
I don't understand step 4. I'm supposed to change variable from subtract to add?
 
lssong99
Old
#9  
Senior Member - OP
Thanks Meter 42
Posts: 139
Join Date: Jul 2005
Quote:
Originally Posted by foxdog66 View Post
I don't understand step 4. I'm supposed to change variable from subtract to add?
It's depends on your time zone. If you are in US, you need replace the "Variable Substract" action with "Variable add" action than put your time zone difference in second.

Tags
glass, line, mirror api, tasker, whatsapp
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


TRENDING IN THEMER...