Does it happen to anyone that in Andorid 11 you can open e.g. an mp3 file with ActivityStarter, but the ResolveActivity function does not return a result?
If I remove the if for the error message and just put the ActivityStarter, it opens the mp3.
Does it happen to anyone that in Andorid 11 you can open e.g. an mp3 file with ActivityStarter, but the ResolveActivity function does not return a result?
If I remove the if for the error message and just put the ActivityStarter, it opens the mp3.
your example is incomplete...
how did you set Action, Datatype, DataUri, ActivityPackage and ActivityClass?
you might want to add an example project as small as possible into this thread, so someone else can test?
Taifun
Sorry, I do put the complete blocks that I have used. The music file opens fine with the player, but in the case that there is no music app installed, the error message would not pop up because ActivityResult does not return any result if there is a music app installed or not, which is what I wanted.
Yes, on devices with Android 11 .ResolveActivity
is an empty string.
However, there is no need to check this as every device has an MP3 (audio) player.
Android 9 (above)
Android 11 (below):
Yes, all devices with android 11 have a player. The case would be to open other types of files (in case the phone does not have the app installed).