Android - How to run another app - android

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);

Related

In an Android game, can you enable the player to unlock something in ANOTHER game (or see another game's high score)?

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.

Guide me about updating app without using intent

I am a new learner of android. I am working on intents right now. I am reading about intents I have few questions about the intents which are bothering my mind if any one can clear the confusion I will be obliged. Questions are :
If we want to upgrade(switch between activities) an app we are using intent. without using intent are there any other possibilities to switch between activities it.
If they are there how can an app update itself.
In what scenario does a good app do it? and in what scenario does a bad app do it?
If anyone can answer these questions in detail or can guide me to a useful resource it will be highly appreciated. Thanks in advance.
Applications are not 'upgraded' through the intent system. Look into the package manager and other aosp system code for that
Intents are either explicit:
I want to open SettingsActivity.java.
or Intents are implicit:
I want to send this text as an email.
These don't have anything to do with upgrading.
Intents are either used to trigger an action or launch an Activity. They are not used for updating or upgrading any app.
For updating an app by itself you sholud have a server to get latest version of app. Every time when app lunches, it should call the server and get the version. If it has diffrence with what is defined in manifest, there is an update.
Now for do updating, you can pass the direct link to browser by intent so that the browser download it or you can download apk file by yourself using Http client from your direct link.

How to pass data to the website opened from android app

I Want to open a site from an app and pass data from that app to that website.Like if we open google page from my app,the searching word should be passed from the app which is nothing but auto-filling.Can anybody please suggest
Thanks,in advance
Use Intent to pass data from one app to an another app.
Go through this http://developer.android.com/reference/android/content/Intent.html link for more info.
In your case, i guess implicit intents would be a better choice.

open gallery google glass

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.

sharing feature in android

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).

Categories

Resources