3

I am using Implicit Intents to open Music player from my application but it is not showing default music player which Android provides Here default MIUI music player option is missing

This is how i am calling my Intent

Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Same thing happens with Gallery

Intent gallery = new Intent();
gallery.setAction(android.content.Intent.ACTION_VIEW);
gallery.setType("image/*");
gallery.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(gallery);

This code automatically opens Google Photo app instead of default Gallery Application Is there any extra line that i need to add while calling my intent??

Note:- I cant open app using PackageName as I want user to choose the app which he wants to open
I also cant pass the uri as I don't want to open any photo or music file by default

Akshay Katariya
  • 338
  • 4
  • 16
  • Try using `Intent.CreateChooser` Ex: `startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);` – Vipul Asri Apr 23 '18 at 05:13
  • Not working @VipulAsri tried just now, this also directly opened Google Photos app – Akshay Katariya Apr 23 '18 at 05:21
  • I do not have `MIUi` to test on. try to implement [This](https://stackoverflow.com/questions/3114471/android-launching-music-player-using-intent) . If this is a Device dependent issue Try to dig in a bit. I can not say much about custom OS because they have lots of differences when it comes to implicit intent. – ADM Apr 25 '18 at 09:41
  • I think i am missing something while calling intent because intent from other application shows defult apps as well – Akshay Katariya Apr 25 '18 at 09:42
  • I have tested on HTC and it worked . I can not make any assumption for `MIUI` right now . Will get back to if i find the solution . – ADM Apr 25 '18 at 09:49
  • sure one more thing i cant pass uri as i simply want to open Music player or The gallery – Akshay Katariya Apr 25 '18 at 09:51
  • Have a look this https://stackoverflow.com/questions/12532207/open-music-player-on-galaxy-s3?rq=1 – Santhosh Joseph Apr 25 '18 at 09:59
  • @SanthoshJoseph I cant do that as i want user to choose from the following chooser i cant force him to open music player from PackageName – Akshay Katariya Apr 25 '18 at 10:02

0 Answers0