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.
Related
I want to check if WhatsApp creates separate activity for each conversation. I want to get an idea because I am creating a somewhat similar app.
(given that I am using a rooted device)
Most probably not . Why would they create separate activity for each conversation ?
But still if you want you can check in this chat app - Telegram , it's similar to whatsapp and it is open source-
Github repo
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.
whenever my app will run, it will create one option in another app to get data from another app.
Well, I am not sure this is possible or not, Please guide
one more I know how to share data in between two app by using sent action but I want to create one separate option in another app for my app when my app start running in android
Is it possible ?
Please guide , Thanks in advance
A content provider component supplies data from one application to others on request. Such requests are handled by the methods of the ContentResolver class. A content provider can use different ways to store its data and the data can be stored in a database, in files, or even over a network.
Link1
Link2
You can do this thing this way :
Intent i=new Intent();
i.setPackage(TARGET_APP's package name);
context.startActivity(i);
You can set value this way with this intent
i.putExtra("KEy",value)
http://developer.android.com/reference/android/content/Intent.html#putExtra%28java.lang.String,%20double[]%29
On the other hand, if you want to read some data from an app, it's possible if and only if that app allows you to do so. Data generated by the app is private by default.
Another way to do this by using content provider
May be this link will help you more about content provider
http://www.tutorialspoint.com/android/android_content_providers.htm
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);
I posted this query here, but as usual, noone knows / no replies
http://www.anddev.org/viewtopic.php?p=41513#41513
How can I launch the android default mail application through the click of a button in my code?
I would also like to know, how this can be done to launch the contacts list also.
Any help in this regard is appreciated,
Regards,
Rony
How can I launch the android default mail application through the click of a button in my code?
Use an ACTION_SEND Intent.
(BTW, I apologize for the formatting of that blog post -- AndroidGuys keeps changing hosting providers, which screws up my posts)
I would also like to know, how this can be done to launch the contacts list also.
Use an ACTION_PICK Intent.