We have an app that starts an activity for SENDTO with the intention of letting the user send an email. the choice of all the various email apps is fine, but we'd like to give the user of bypassing that step in the future ... e.g., add a "remember this decision" button at the bottom of the chooser. from then on, we'd launch that specific activity instead of getting the chooser.
I'm wondering if we can interact with the built-in create chooser functionality at a lower level to affect this. If not, could someone point / post some code snippets for this? I suppose the trick is understanding how to get a list of activities that can handle the intent.
I've seen a lot of questions about modifying the app chooser, and they all seem to state that no, you cannot change the built-in app chooser, but you can create a custom app chooser using queryIntentActivities() in the PackageManager class.
Related
Is it possible to open android dialer directly. The standard solution (via Intent.ACTION_DIAL) does not suit me, because it create intent chooser, and there are other dialer apps, like viber. Any solutions?
Unfortunately there is no way to directly open the dialer because you cant tell all the dialers package names on all the vendors, for instance a Xiaomi dialer would have a different package name than the LG one.
The only way is to use Intents to ask the OS to open the dialer, if there is a default dialer selected it will open the default one, if default is not selected the user will be asked to choose.
This is the correct and expected behavior and is made so for a reason.
My Android app has to allow the user choose which app will open a certain file format, exploiting the system chooser, so next time a certain intent is handled as the user decided.
I would like that it is able to open a chooser of apps for an intent but without opening the chosen app.
I mean, the chooser has to be called just to have the user choosing the app but the app wouldn't open.
Is it possible, maybe with a special intent or workaround?
Your requirement is a little bit like the one feature in "Android for Work", maybe you can check it.
I understand that Android does not allow you to call an emergency number (911) directly. So I have decided to use Intent.ACTION_DIAL instead to leave the app and have the number pre-dialed, ready to call. However, the app chooser appears when I hit my 'Dial 911' button, adding another unnecessary step to the process (the other option besides the Phone app is to scan the number using Lookout Security).
Is there anyway to bypass the app chooser by pre-defining the app to handle the Intent?
There are many possible dialers. You have no good way of determining a priori which is the "one true dialer" that the user wants to use. Moreover, the user should be able to click "Always" on the chooser and therefore only encounter this once.
If you want, you could allow the user to choose their dialer up front, perhaps as part of configuring your app. You can use PackageManager and queryIntentActivities() to find out what all supports ACTION_DIAL, presenting that to the user to choose from. You would remember the ComponentName of their choice, and add that ComponentName to the ACTION_DIAL Intent that you use "for realz" when the user presses the button in your app.
I don't understand why one needs to use Intent.createChooser when using implicit intent. According to Android docs "If multiple intent filters are compatible, the system displays a dialog so the user can pick which app to use". So if the android system pops up a chooser dialog why to use createChooser method?
Thank u in advance
yes, android system will do this for you. But once you choose an item from the dialog, the system will keep it in mind and it will NOT show the dialog next time if the user chooses a "default". this isn't always what you want. Suppose you have a share button, you certainly don't want your users to share with a same approach all the time. So it's the case where you'll need a createChooser call. This forces the system to show the choosing dialog each time.
you can refer to this
i'm trying to port my android application to windows. in android, there is a way to start an activity with the ACTION_SEND flag i.e.
Intent intent = new Intent(android.content.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "....");
startActivity(Intent.createChooser(intent, "Subject"))
when you do this, a list of applications (i.e. facebook, text messaging, twitter, evernote, etc...) that can receive the passed in information is presented. the user selects one and information can be shared thus.
is there something analogous in windows phone 7?
Yes, Windows Phone 7 does have something similar. Take a look at Launchers and Choosers.
With launchers, you can launch another application but you do not get any information back from the newly launched application after it ends. This is similar to startActivity in Android. With choosers, you can receive information back, similar to startActivityForResults. There are a bunch of launchers and choosers available.
Windows Phone 7 currenlty includes no publicly available direct equivalent to Androids Intents.
To access system data and to perform certain actions that are built into the core of the OS and require user interaction, it uses Launchers and Choosers which can seem similar. It is not possible to create your own ones though.
If you want to add functionality like sharing to Twitter, etc. you'll need to add this functionality to your application.