I want to launch gallery to pick an image in my google glass app. for android mobile it is straight
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, REQ_SELECT_FILE);
when i am running same code in glass, it fails with error
07-29 16:12:45.941: E/AndroidRuntime(15847):
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.GET_CONTENT }
Seems related Component is not part of gdk. then what should be the alternative. i sure they must provided some other way to use images saved on device. any pointer around that wd be appreciated.
There is no gallery on glass to select images, documents, or anything. (technically this intent doesn't exist on glass) Glass is a glance based system so they don't include systems that are in android that cause the user to interact with the device for extended periods of time.
If you want to select an image you are going to have to build it yourself, but chances are it probably shouldn't be in a glass app to begin with so Google will probably request you to remove it anyway.
Concur with what #w9jds has said. It sounds like you're thinking about your app in a fairly non-glass-like way. If you re-think it, it might still do what you want, work better on Glass, and be a better user experience.
If you're looking at sharing or sending a picture, for example, it might make sense to leverage the Contacts that are provided by the Mirror API. People can take a picture and then share it to your service or to contacts that your service has provided to Glass. It takes care of making sure that the upload succeeds so you don't need to.
Even if you're not using this for some reason, it is a model that you should likely adopt. Your app should guarantee the upload succeeds (eventually) so the user should never have to retry it. You can implement the horizontal scrolling to select a picture that your app generated. There is currently no pre-provided tool to do this in a GDK app.
Look at and use the existing Glassware as a model. They were designed the way they were for a reason.
Related
I have ShareActionProvider in my Application. it shares a photo I uploaded with a text I insert. When share is done, I want to show a popup message/dialog with a button OK, clicking on which I should return to my application. The question is: in my application how can I know if share is complete or no ? For example, if I share the photo and text in instagram, how can I know that post is already done.
in my application how can I know if share is complete or no ? For example, if I share the photo and text in instagram, how can I know that post is already done.
That is not possible for ACTION_SEND. What the user does with the shared content in the other app is between the user and the developers of the other app. The user might do something immediately, later, or never. The app might do something immediately or later (e.g., upload the content as part of a periodic sync operation with a server). There is no protocol for the receiving app to tell you that sharing is "done".
Specific apps may offer specific APIs, beyond ACTION_SEND, that offer capabilities in this area, but those will be unique to those apps.
Use a Toast like this: Toast.make(context "Uploaded", Toast.LENGTH_SHORT).show();
Toast is just tiny little "popup"
Applications of these two ideas could include enabling the player to see his or her progress in earlier games within the latest sequel, being able to keep the same character/progress across games, etc. etc.
While the best solution is likely having the player create an account they use across games, I'd like to avoid that if I can (both because players are already logging into Google Play Games, and because I currently do not have access to server infrastructure to handle doing that). Is there any other official/popular mechanism for passing data between games, or is the account route the best bet?
I believe that this is what you are looking for, Interacting with Other Apps especially the Sharing Simple Data and Sharing File section. You may also refer to this documentation for Receiving Simple Data from Other Apps which suggests that you will need an ACTION_SEND intent filter.
Update Your Manifest
Intent filters inform the system what intents an application component is willing to accept. Similar to how you constructed an intent with action ACTION_SEND in the Sending Simple Data to Other Apps lesson, you create intent filters in order to be able to receive intents with this action. You define an intent filter in your manifest, using the <intent-filter> element.
Handle the Incoming Content
To handle the content delivered by an Intent, start by calling getIntent() to get Intent object. Once you have the object, you can examine its contents to determine what to do next. Keep in mind that if this activity can be started from other parts of the system, such as the launcher, then you will need to take this into consideration when examining the intent.
I think this would be a good place to start on how to pass data from one app to another. You will also need to make changes in your current implementation both in your existingt and new app for this to be possible.
The other solution to this is to have all the games share a common Play Game Console configuration. You can have multiple packageIds point to the same appId, so they see the same list of achievements, leaderboards, etc.
Depending on your specific requirements, you could simply change the descriptions of the items to describe which game they are for, or implement custom UIs to display the lists.
I'm looking for a way to find out which browsers are installed on the Android Smartphone and their package names.
Why do I need it?
Well basically, my App reacts on certain URLs, i.e. http://bit.ly, so when the click such an he will get an choice in which App to open it. So far everything is working as intended.
If the user sets up this app as default for this kind of links, it will always open in this one without further asking the user. So far so good too. But by doing this, he will be completely unable to open this links in his browser.
So I need a way to send this intent directly to the browser, but to do so I have to know which app the user has set to be default for http/https scheme for example (as user can change it if there is more than 1 browser installed).
Sending the intend with
intent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
should't be a problem I think. The problem is, I can't send a standard intent für URLs, because my App would catch it again if set as default by the user.
should't be a problem I think
Hardwiring in the package and class names of code that is not yours is always a problem.
So I need a way to send this intent directly to the browser, but to do so I have to know which app the user
has set to be default for http/https scheme for example (as user can change it if there is more than 1
browser installed).
Use PackageManager and queryIntentActivityOptions() to filter your activity out and get a list of other activities that the user can choose from.
I am interested in opening the Google Navigator app from inside an application I am writing. I want to be able to spawn it at a given time and pass specific data into it.
Can anyone think of a good way for me to do this? What permissions do I need, etc? Thank you very much.
You are looking for intents. These are messages you throw up to the system that allow the appropriate action to be taken, such as opening another application.
Here is a guide to using Intents and Intent Filters.
In particular, here is a page that discusses the intents you should use for Google's applications, including Google Maps.
Also, see here for a similar question asked on Google's forum.
A sample of example code that works is as follows:
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse("google.navigation:q=New+York+NY));
startActivity(i);
Is it possible to share my video or my photo from my application on the web in android?If possible how to do this? I made a application and now i want to share some my feature on the web so how i can do it?
Thanks
Depending on what exactly you mean, it’s possible that this functionality is already built in. Using the ACTION_SEND intent allows the system to coordinate activities to share arbitrary kinds of data. Applications exist that can send images and videos to Twitter, YouTube, Picasa, MMS, Bluetooth, etc.
Something like this (untested) will inform the system that you have an image to share:
Intent msg = new Intent(Intent.ACTION_SEND);
msg.setType("image/jpeg");
msg.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/foo.jpg"));
startActivity(Intent.createChooser(msg, "Share image"));
Now, if you want your application to send images specifically to your web service, you can still use this send intent, but also include an activity that can handle this sort of request. If you still use the intent chooser, the user will have the advantage of being able to send their images and videos to other places besides your web service, and your application will feel like an integrated Android app. On the other hand, bypassing the intent chooser and just uploading it directly makes your app feel more streamlined but less flexible.
The Android API includes the org.apache.http framework for talking to web services.
#rbads, this is an old question so i don't know if it's still pertinent, but you can also share with Socialize -- www.GetSocialize.com. We use the concept of "entities" and have likes, comments & sharing around each entity (entity = unique piece of content in your app).