HTC Delivering Ads Straight to Sense Home

HTC’s 2015 has been a year marked by a desperate search for revenue.The HTC One M9 … more

Galaxy S6 & Edge get €100 Price Cut—New Models Incoming

Samsung has dropped the price of both the Galaxy S6 and S6 Edge by … more

How To Port Fully Featured Sony Xperia Z4 Camera

Xperia Z4’s hardware may not impress, but its software is definitely … more

Experimental TWRP Available For Moto G 2015

XDA Senior Member squid2 has posted experimental builds of TWRP for the Moto G … more

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

163 posts
Thanks Meter: 54
By lssong99, Senior Member on 12th May 2014, 12:16 PM
Post Reply Subscribe to Thread Email Thread
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" 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 (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, 74 views)
Last edited by lssong99; 12th May 2014 at 12:32 PM.
The Following User Says Thank You to lssong99 For This Useful Post: [ View ]
12th May 2014, 12:18 PM |#2  
OP Senior Member
Thanks Meter: 54
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:	301
Size:	171.8 KB
ID:	2739397   Click image for larger version

Name:	Screenshot_2014-05-12-15-29-52.png
Views:	260
Size:	122.0 KB
ID:	2739398  
12th May 2014, 12:19 PM |#3  
OP Senior Member
Thanks Meter: 54
14th May 2014, 02:48 AM |#4  
jewnersey's Avatar
Senior Member
Thanks Meter: 555
Donate to Me
This looks pretty cool. Sorry if I missed it, but does glass automatically turn on, visual, for each notification?
14th May 2014, 08:33 AM |#5  
OP Senior Member
Thanks Meter: 54
Originally Posted by jewnersey

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.
15th May 2014, 01:33 AM |#6  
Junior Member
Thanks Meter: 2
Got any way to go the other way? From Glass to phone? Would be great for voice commands for home automation.
21st May 2014, 06:42 PM |#7  
OP Senior Member
Thanks Meter: 54
Originally Posted by Frunple

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!
3rd June 2014, 09:21 PM |#8  
Senior Member
Thanks Meter: 44
I don't understand step 4. I'm supposed to change variable from subtract to add?
5th June 2014, 06:03 PM |#9  
OP Senior Member
Thanks Meter: 54
Originally Posted by foxdog66

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.
Post Reply Subscribe to Thread

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

Advanced Search
Display Modes