Locate Glass's location on Google Map - google-glass

Is it possible to have Glass do a POST on it's current coordinate to the server while running other apps, say, Google Hangout or take a picture?
Is there any example or APIs I can leverage?

If you are using Goggle Glass GDK, you can use an AsyncTask to to do work. If you are using Mirror-API, then that is a separate app, and it can work simultaneously (see GlassWare Fieldtrip).

Related

Hybrid app in Google Glass

Is it possible to build a single app that can work as native(GDK) and also insert cards into my timeline with Mirror API. Or i have to build separate apps for GDK and Mirror API.
I am aware that we can invoke a GDK app from a card inserted through Mirror API. But these are
in essence two different apps interacting.
So is it possible that i can do the whole authorization through GDK app?
It is certainly feasible to have a GDK-based app on Glass call the Mirror API to insert a card. Calling the timeline.insert endpoint is not a big deal. You will have bigger issues if you're trying to handle callbacks since you'll need a stable IP address, but if all you want to do is insert cards with a URI to use as an intent trigger, that part is not an issue.
The issue you face, as you noted, is to do the authorization through Glass. This part is still immature in the GDK, and although there are some workarounds, there is nothing that Google provides yet that can help with this. Auth support is quite frequently requested, so expect something to address this as the GDK matures.

Take a picture and share it with one voice command using Google Glass Mirror API

I just started using the Mirror API with a PHP web server. Is there anyway to integrate a voice command with my app that when said, Glass will take a picture and automatically share the picture with my server?
From what I read so far, it doesn't seem possible to access the camera with anything other than the default "Take picture" command. I also don't see a way to have Glass commit two actions (in this case take a picture and then share it) with one voice command. Is there any way to do the above with the Mirror API?
This isn't possible with the current features provided by the Mirror API. If this is a feature you're interested in using, file it in the official issue tracker.
However, you can implement this functionality with the GDK.

Location on Google Glass

Is it possible to get the user's location without using the Mirror API?
The hacking glass Google I/O video mentioned several android apis currently work and listed gps as one of them, however I have not had luck so far. I know Glass does not have GPS itself and must use the paired phones GPS. Would be awesome if we could use existing android location manager or newer Google play services location apis!
Yes, you can - if you use the GDK examples as a base and follow the Location Strategies (http://developer.android.com/guide/topics/location/strategies.html).
For a specific example, I just posted a hack of the GDK Compass sample in answer to another question that adds location updates pulled from the GPS (with or without a paired phone):
Can GPS for Glass be accessed through the Android SDK?
Google Glass does NOT have a GPS chip in it. I don't see why you could not have an apk that uses the LocationManager and add a listener to it that would print out the latitude and longitude in Logcat or even on GLASS itself. Now, to get that location to a remote user, that would require more work than not using the Mirror API.

What is the difference between Glass Mirror API and Google GDK?

What is the difference between Glass Mirror API and Google GDK?
Google has announced the GDK here: https://developers.google.com/glass/gdk
but they haven't exposed any new features specific to Glass yet. How do we actually use the Google GDK?
Looking at the examples listed on the above link, we can create APKs, load APKs onto Glass and launch them using adb shell but is there a complete app or example anywhere?
The difference between the Mirror API and the forthcoming GDK boils down to where the application being written will run.
The Mirror API specifies how a web-based application will communicate with Google's servers to send updates to a user's Glass and how it will receive notifications when the user takes an action (such as a share, or a location change) that is directed at the Glassware.
The GDK is intended for applications that will run on Glass itself and have more low-level access to the sensors and to the underlying Android environment that Glass is built on top of. Google has not released the GDK yet - that page is where it will be released, and provides some early "getting started" concepts for developers who are interested in building native apps that run on Glass.
GDK has not been launched yet, so you cannot actually use it right now.
GDK will allow you to work directly on the Glass device using your Android development skills whereas Mirror API is a cloud/web-based API for interacting with a user's timeline only. See Prisoner's answer for more detail on this.
Because GDK has not been released yet, "complete" apps and examples do not exist. There are three samples (Compass, Level, and Stopwatch) listed on the link that you posted. The page says that these samples will eventually be updated into a "full Glass experience" when GDK is launched.
When we launch the GDK, we'll also update these samples to show the migration path from a traditional Android app to a full Glass experience. Make sure to check regularly for updates
Glass Mirror API is for developing the Glassware(Pushing Webcards from server to Glass).
Google GDK(Glass Development KIT) is similar to current Android SDK, but they will have some special tool that will help develop Android Apps for google glass. Even now without GDK, developers are developing apps using Android SDK.
GDK will allow you to run apks on GLASS along with the GlassHome. GlassHome is the main display that you see within GLASS. If you install an APK without the GDK, the only way to get to it is using something like Launcher2.apk. With the GDK, and this is an assumption, your apk will be represented as a card within GlassHome.

Server Generated web screenshots?

One problem I've been toying with off and on is a service that requires my server to produce a screenshot of a webpage at a given url. The problem is that I don't have any idea how I would accomplish this. I mostly use a LAMP software stack, so answers that were given with that in mind would be the most helpful. Again the basic requirements are: Given a url, the server needs to produce an image file of the rendered web page at that url. Thanks in advance!
You might also want to take a look at webkit, it's known for being easier to embed (used by Adobe for AIR, by Google for Chrome, by Apple for the iPhone...) then other rendering engines. This might take a little more work to setup, but it would be a lot more stable than some hack that launched a webbrowser and took a screenshot.
IF your server is a Mac, then I recommend webkit2png, which is a short python program that leverages WebKit's Objective-C API to render an URL. Personally, I use it in combination with WWW::Mechanize to walk my development site and make screenshots of every page -- useful for testing functionality, showing clients and keeping screenshots up-to-date. The resulting screenshot is perfect, but sometimes very tall for long, scrolling pages.
IF your server has a non-bare-bones Linux distro with KDE installed, then you might try khtml2png. I have not tried that myself, but saw it mentioned on the webkit2png page.
PhantomJS is a headless (commandline) WebKit-based browser which can be easily scripted to save a screenshot of webpage.
You actually need to have the server launch the web browser in question and take a screenshot of the application with the appropriate libraries. Apache will not render the page for you so you have to have software that will.
Yes, that is what is needed. I do this in asp.net, and I actually create a WebBrowser object that is avaialable in the .Net framework class libraries to generate the screenshot.
I use the http://webthumb.bluga.net service for thumbnail generation. Robust, powerful, easy to use, and very reasonable rates. I have a high traffic production website using this service and it works very well. Given the difficulty of creating a robust web screenshot service, it's nice to have someone else do the hard work.
A non-free solution for Java is WebRenderer. Interesting feature: it can emulate Safari, IE or Firefox browsers when rendering. They have a desktop version and a headless server version. Also they have example code showing how to render a screenshot image of a webpage.
virtual framebuffer X server
I would rather recommend XVFB (virtual framebuffer X server) is the best solution for taking screenshots of a headless server. Virtual framebuffer X server xvfb provides an X server that can run on machines with no display hardware and no physical input devices.
I am using that on my server for testing URLs and taking its screenshot. We are using Ubuntu & XVFB + FIREFOX. It is working fine. Modify according to your needs.Take a look on these articles. It might be use full for you.
http://www.semicomplete.com/blog/geekery/xvfb-firefox.html
http://linux.about.com/cs/linux101/g/xvfb.htm
http://www.xfree86.org/4.0.1/Xvfb.1.html