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.
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.
it's possible to disable/remove this photo confirmation dialog:
I need somehow skip this dialog but I still want use an Intent. I found this android: Take camera picture without "save" / "delete" confirmation but I don't want use SurfaceView .
I need somehow skip this dialog but I still want use an Intent.
That is not possible.
There are over 8,000 26,000 Android device models. Across them, there are hundreds of different pre-installed camera apps. Additionally, there are hundreds of additional camera apps that users can install from the Play Store or elsewhere. Any one of them could respond to your ACTION_IMAGE_CAPTURE request.
The protocol for ACTION_IMAGE_CAPTURE does not have an option for "do not show any sort of confirmation dialog". Some camera apps will have such a dialog, others will not. A few apps might have some undocumented Intent extra for controlling that behavior, but most will not.
Either:
Live with the confirmation prompt, where it exists, or
Do not delegate this work to a third-party app, but instead use the camera APIs to take a picture yourself (the SurfaceView approach that you rejected, though it does not necessarily need SurfaceView), or
Do not write the app
Use "android.intent.extra.quickCapture" in Intent.
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extra.quickCapture",true);
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 need to display pdf in Android. To do so I launch an installed pdf application thanks to an Intent with ACTION_VIEW.
Let's consider that there is no popup asking the user to select its favorite pdf application (my Intent targets an explicit pdf reader).
Of course this works but there are 2 processes on the device, my app and the pdf reader. As a consequence the user can switch between this 2 apps (it is possible to come back to my app without closing the pdf reader app). Is there any mean to avoid this behavior ? For example, this is not observed when the camera is launched (using the intent filter android.media.action.IMAGE_CAPTURE).
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.