Publishing Photo to Glass Timeline using GDK and NOT Mirror - google-glass

I am working on a Google Glass application that will apply a filter and then take pictures. We used to use Card and TimelineManager to do this, but both were discontinued.
I'm currently using CardBuilder in replacement of Card, and I am able to take the photo and save it in Glass memory, but I would also like the photos to show up with the rest of the pictures taken outside my application (directly from Glass).
Most suggestions I found to publishing to Timeline require using Mirror. However, I don't want my application to require Internet access. Is there a way to publish to the Timeline without using Mirror?
I'm new to Glass and Android coding so any help will be appreciated :)

I've never tried TimelineManager before but I think Live cards is what you're looking for. It's used for publishing information to the timeline. No access to the internet required.
The doc has the sample code and some sample apps also use it.
Note: Static card is not supported by GDK as of now.
Hope this helps.

So there are two things. If you want the picture to appear to the left of the time (which would mean foreverish) then you want to use Live Card as suggested above. However, if you want to add it to the timeline (which is to the right of the time) then you can't add that via the GDK anymore.
Google felt that the Mirror API was built specifically for this and the Timeline Manager defeated the purpose of it so it was removed.

Related

How to measure the total amount of time my React Native app gets used

I am about to launch a beta version for my react native application, and I want to get information on how much time users stay on my app, and actually use it, how frequently they enter it etc. That would help giving me feedback. Also could be useful to know which pages get used the most. Is there such a thing that exists for that?
You may use analytics in your project. Google Firebase provides analytics. But I use Appcenter Analytics for my app. You can add custom events as well to track which page the user has opened or to find whether the button was clicked by user. Here is a screenshot from Appcenter dashboard.

Facebook API for custom feelings/activity

I was searching in the Facebook API documentation, but I can't find what I am looking for. So, what I am looking for is is there an API for creating your custom DO action. For example:
John Johson is riding a bike.
What I want is to send this 'riding' as a custom word coming from my app. And also 'bike' as a custom item as well.
The other example I can think about is the running apps in Facebook. When you start to run and connect the app with your Facebook the app can say.
John Johson is running using Runtastic.
Thanks!
Well, you’re a little too late on that one.
That used to be possible, it was called Custom Open Graph Actions - https://developers.facebook.com/docs/sharing/opengraph/custom
But those are now deprecated, you can not use them any more in new apps (and for existing ones, they will be removed within a year as well), see https://developers.facebook.com/docs/sharing/opengraph/custom-open-graph-deprecation
Now you can only use the built-in actions and objects, https://developers.facebook.com/docs/reference/opengraph

Navigate to the timeline (to the card with bundleId) from within an application

I have a Glass application that is activated by a voice command. The user requests a product and the request is then passed on to a node.js server, which handles the bulk logic of my application. When the node server is done, it builds some HTML templates that it passes on to the Mirror API, which then puts those cards into the timeline of the Glass app.
Now the problem I have is this:
When a user requests something from within the application, he just stays within that application but the cards from the Mirror API are put onto the timeline.
Is it possible to navigate the user from within the application to the timeline item that has just been inserted?
As I build the Mirror API timeline item, I know ahead of time what the bundleId will be on the timeline, so can I use that somehow to navigate to that item on the timeline?
I've had a look here on Stackoverflow, the Glass forums and the official documentation and couldn't see anything that would help.. Anybody here have any ideas?
Currently the only way for forcing a specific card to show in the timeline is by using a LiveCard (https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/timeline/LiveCard). Live cards will automatically be given focus when published and you can force the timeline to give your card focus after publishing by calling LiveCard.navigate().
So unfortunately unless you want to change some of the fundamentals of your app, this isn't going to be much help.
Though from the sounds of it, you may be able to use a LiveCard to show what is returned from your server. If you want to perform inserts via the mirror API, this could still be done in addition.

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

can google glass to identify bar codes and have your device subscribe to them?

Will there be a way to allow glass to identify bar codes and have your device subscribe to them? I've only seen location options so far. If not can you subscribe to a photo taken to determine if it's a bar code? or have your program added to menu options available to photos taken?
The closest you can get to this with the current version of the Mirror API is with a share Contact.
Take a peek at the Add A Cat to That example use case. It describes a scenario in which a user shares a photo with a contact that represents a Glassware and adds a picture of a cat to it. You could use the same flow to download the photo, identify bar codes, extract the encoded information and take an action within your Glassware.
Here's a sequence diagram of this image processing flow:
Note that in this case the user must explicitly share each photo to be scanned for bar codes. If you have an idea of how we can extend this API to support this functionality, please file it in the official issue tracker.
It should be possible to do something like this with the API by registering your "Bar code reader" as a Contact and adding a subscription
This will allow users to share photos with you, meaning you can retrieve the image on your server and check if there is a bar code, decode it and perform some action based on it.
This is not yet supported by the Glass client nor the API. Feel free to file a feature request in our issue tracker.