How to add another option to the share functionality of Google Glass? - google-glass

I am interested to add my service into the share functionality of the Google Glass, my flow is below:
1. Take photo / Record video
2. Share with -> My service
3. the photo or video should be uploaded to my site
Is this functionality possible? it is very similar to Facebook and G+ share options.
I will be happy to know how to do it, Thanks.

What you are looking for is what the Mirror API calls a Contact. Your Glassware can setup one or more Contacts, specifying what content type can be shared with you and/or if there are voice commands which will trigger the Contact.
You will also need to setup a Subscription which will be the public URL for an HTTPS enabled server that the Mirror API will use to send you the content that was shared with the Contact.
In general, the flow when a user first authorizes you to write to their time would be something like this:
Add a Subscription, so you can get callbacks.
Add one or more Contacts. In your example, you would want to register the Contacts to have acceptTypes of image/* and video/*, although you can also omit the acceptTypes to get everything (including text).
The callback you register with the subscription should be able to handle a JSON body, and should return HTTP code 200 as quickly as possible. A good procedure is to actually accept the body, place it on a job queue for processing later, and immediately return the 200 code. When processing the body, you may want to do something like
Confirm the userToken and verifyToken provided are valid.
Using the itemId, get the Timeline item, which will include attachment information about what was shared with you.
If the attachment is marked as isProcessingContent, then the content isn't ready for you and you should return the job to the queue and try again soon.
If isProcessingContent is false, you can use the attachment URL with the authentication token for the user to fetch the content itself.
There are a lot of details I've glossed over here. For a further overview of the flow, see https://developers.google.com/glass/develop/mirror/contacts

Related

Realtime Updates from FB API

I have a working Azure function that receives updates when I use the Graph API Explorer.
All I want to be able to do is submit a UserId to an endpoint and have any Posts they make sent to my WebHooks. We want to do this without the users always having to give permission. Unfortunately, I find the FB docs very confusing as most pages only have partial examples and the majority of the online SO or blog examples are far out of date.
On the FB WebHooks page it says
For example, if you subscribed to the user object's photos field and one of your app's Users posted a Photo, we would send you a POST request that would look something like this
They then say
You can also do this programmatically by using the /{app-id}/subscriptions endpoint for all Webhooks
On the Subscriptions page they have this example
POST /v12.0/{app-id}/subscriptions HTTP/1.1
object=page&callback_url=http%3A%2F%2Fexample.com%2Fcallback%2F&fields=about%2C+picture&include_values=true&verify_token=thisisaverifystring
But then its says this under Permissions
Subscriptions for the object type user will only be valid for users
who have installed the app.
This is not for a mobile app..so I'm confused
The above is to show that I have made all attempts to get this working without first posting here.
Now, I have to ask. Do anyone have experience or a existing code that demonstrates how to Subscribe to a User so that when they Post, I receive Notifications via webhooks?
Or, this this entirely the wrong way to use the Webhooks?

Providing direct links to Auth.Net admin, specifically refunding

I've got a frontend app that handles payments via Authorize.net. In the end, I've got a TransactionId attached to my own order object.
I would like to provide a direct link for my staff that takes them to the transaction in Authorize.net.
Our specific use case is for refunding, and I figured out this link in the sandbox: https://sandbox.authorize.net/UI/themes/sandbox/transaction/QuickRefund.aspx?TransID=1234567890
I would rather send them to the transaction, and let them click the refund button to get that page though.
This doesn't work: https://sandbox.authorize.net?TransID=1234567890
Anybody have any ideas? I could always write my own endpoint that does a refund via the api, but a direct link would be good enough and much easier if it exists.
This functionality does not exist. You will need to build your own endpoint that uses their AIM API to process the refund.

Add video to timeline from GDK or Add "Share" to live card

I'm using the GDK with XE16
I would like to save a video using MediaRecorder and then put it on the Timeline so I can let the user share the video to Gplus, YouTube or any contact. I am providing some additional information during the recording process as an overlay on the video preview.
I am able to save the videos into the /mnt/sdcard/Movies path. I am invoking the Intent.ACTION_MEDIA_SCANNER_SCAN_FILE to add the recorded video to the media database.
I have not been able to figure out how to add a share intent to on livecard. The previous API supported static cards, but those did not support video attachments; and the API is no longer available. I have also tried to use AccountManager and the com.google account in Glass to get an ouath token for the Mirror api to write direction via oauth2:https://www.googleapis.com/auth/glass.timeline. The authorization request shows up, but it is impossible for the user to accept the request.
I've considered sending the video file back to a proxy server that will then call mirror, but this seems like a big round trip for nothing.
I suppose I could send the credentials through this proxy, but this seems like a security nightmare.
The difference between Static Cards and a Timeline Item were large enough that the team, apparently, removed Static Cards until they could make the two of them work much more similarly. What you're trying to do is a commonly requested, and it does make sense that both should work mostly the same way.
You're on the right track for how to handle this at the moment - use the Mirror API to get it into the timeline as a Timeline Item. As you've noticed, you can't go through the auth flow since the user is unable to authenticate through Glass directly.
While you're testing, you can code in an auth token and a refresh token to be provided to the library to do this. For production through MyGlass, take a look at the auth flow that is available at https://developers.google.com/glass/develop/gdk/authentication

How to create a facebook event on users behalf using javascript sdk

I'm trying to piece together information and different chunks of code scattered throughout the documentation on how to make this happen, since there aren't good examples.
I know I have to first get the create_event extended permission which I get with this code:
FB.login(function(response) {
// handle the response
}, {scope: 'create_event'})
;
I know that I also have to issue a HTTP POST request to 'PROFILE_ID/events' with the create_event permissions and the necessary parameters.
My problems are: 1. I don't know how to collect the create_event permission once it is given. If I run the code above, a dialog box will open asking for the permission but once I accept, only a blank page follows.
2. If everything works the way it supposed to with the permissions request and the post request, will my app see a create event page like I would if I were to create an event on my own from my profile? What interface gets seen from the app? Can I take a user from my app directly to the facebook create event page?
I don't know how to collect the create_event permission once it is given. If I run the code above, a dialog box will open asking for the permission but once I accept, only a blank page follows.
That’s how it works. Everything you want to show to the user after successful login, you have to implement yourself.
If everything works the way it supposed to with the permissions request and the post request, will my app see a create event page like I would if I were to create an event on my own from my profile? What interface gets seen from the app?
No “interface” at all – it’s up to you to build that.
Can I take a user from my app directly to the facebook create event page?
The user can go their by themselves. Why would the need your app for that?

What Web Applications Do You Know Using Webhooks

Description of how a webhook works from http://webhooks.pbwiki.com/ -
How do they work?
By letting the user specify a URL for various events, the application will POST data to those URLs when the events occur...Among other things, you can:
create notifications to you or anybody via email, IRC, Jabber, ...
put the data in another app (real-time data synchronization)
process the data and repost it using the app's API
validate the data and potentially prevent it from being used by the app
Who is using web hooks?
DevjaVu, BitBucket, GitHub, Shopify, Versionshelf, PayPal (IPN), Jott (Links), IMified, PBwiki, Facebook (Platform, sort of), Mailhook.org, SMTP2Web, Astrotrain, Notifixious, Assembla, ZenDesk, Google Code
Do you know of any good uses of webhooks?
AlertGrid is the webhook consumer. You can configure it to accept http calls from ANY source and raise alert (email, sms, phone) to a specified person or group of people (works worldwide!) whenever the parameters in the http callback meet your criteria or when the http call was expected but it didn't occur (kind of 'heartbeat' monitoring). There is a visual editor for you to easily create rules.
Apart from notifying people by sms or email it can also notify existing applications by sending the http requests to their APIs.
It can also visualise data received in http callbacks and show the history.
Unfortunately, the wiki is not the most up to date list of known implementations. I have my own list that I'll put on the wiki when I get around to reorganizing it. Some not mentioned in the current list:
Dropbox
Gnip
Google Code (Project Hosting)
Checkout by Amazon (both for notifications and as actual callbacks with return data)
Hubilicious
Beanstalk
Google Checkout
MailChimp
SurveyGizmo
Hey!Watch
MySpace (for app developers)
I know shopify is using webhooks quite successfully now. By extension so is fetchapp uses them as well. You either are sending an xml file, or receiving one and doing your own processing logic on it.
Oh and shopify's wiki in the link has a whole write up about how to implement it in your app.
OfficeAutopilot has an interesting version of webhooks.. they use their rule interface to trigger API posts. Can trigger in response to any system event.. email opens, clicks, page visits, purchases, etc, etc.
Kiln 1.2 uses webhooks much like GitHub, BitBucket, etc.
(Disclaimer: I'm a Kiln/FogBugz dev.)
Say for example you want to get data from any API( eg. twitter, facebook etc.,). Instead of you polling the data for every few minutes/seconds, it POSTS the data to the specified URL, whenever it is available.
By using this, you will avoid unnecessary polling like say you poll and data is not there yet.
StorageRoom is a JSON-based CMS that supports webhooks, so that you can notify other services or kick of some manual processing on your own servers.
(Please note: I created the service myself)
If you want to connect one service that supports webhooks to another service's API, you can check out IronWorker's webhook support. Here's a blog post that walks through connecting github webhooks to HipChat:
http://blog.iron.io/2012/04/one-webhook-to-rule-them-all-one-url.html
There are some other examples here too, one that takes a chargify callback and posts to Campfire.