JohnC Expert Licensed User Longtime User Aug 25, 2019 #1 I am currently embedding an image ("stream") into an intent that is used to create a new shortcut using this code: Code: Copy shortcutIntent.SetType("image/*") shortcutIntent.PutExtra("android.intent.extra.STREAM", image.bmp) (note: I need to embed the actual file data into the intent and not a uri reference because of various project requirements) Then when the shortcut is used to launch my app, I extract the image data using this code: Code: Copy Dim r As Reflector r.Target = StartIntent Dim bmp As Bitmap = r.RunMethod2("getParcelableExtra", "android.intent.extra.STREAM", "java.lang.String") But I would also like to add a sound file (.wav) into the same intent, so how could I embed both media files/types into the same intent? I ask because the ".SetType("image/*")" method and the "PutExtra("android.intent.extra.STREAM") method don't seem to have any type of "index" parameter to specify which "Settype" is associated with each "extra.stream". So, it gives me the impression that you can only embed one media/file in an intent. Is there a way I can embed multiple media types and/or multiple files (of the same media type), and then how would I extract each one?
I am currently embedding an image ("stream") into an intent that is used to create a new shortcut using this code: Code: Copy shortcutIntent.SetType("image/*") shortcutIntent.PutExtra("android.intent.extra.STREAM", image.bmp) (note: I need to embed the actual file data into the intent and not a uri reference because of various project requirements) Then when the shortcut is used to launch my app, I extract the image data using this code: Code: Copy Dim r As Reflector r.Target = StartIntent Dim bmp As Bitmap = r.RunMethod2("getParcelableExtra", "android.intent.extra.STREAM", "java.lang.String") But I would also like to add a sound file (.wav) into the same intent, so how could I embed both media files/types into the same intent? I ask because the ".SetType("image/*")" method and the "PutExtra("android.intent.extra.STREAM") method don't seem to have any type of "index" parameter to specify which "Settype" is associated with each "extra.stream". So, it gives me the impression that you can only embed one media/file in an intent. Is there a way I can embed multiple media types and/or multiple files (of the same media type), and then how would I extract each one?
E emexes Expert Licensed User Longtime User Aug 25, 2019 #2 Does using a (single) List or Array of multiple Extras work? eg something like: Code: Copy Dim LotsaStuff() As Object = Array As Object(ExtraPicture, ExtraSound, ExtraVideo) shortcutIntent.SetType("image/*") shortcutIntent.PutExtra("android.intent.extra.STREAM", LotasStuff) and then on the receiving side: Code: Copy Dim r As Reflector r.Target = StartIntent Dim LotsaStuff() As Object = r.RunMethod2("getParcelableExtra", "android.intent.extra.STREAM", "java.lang.String") 'presumably .String should be .Array or similar Dim bmp as Bitmap = LotsaStuff(0) Upvote 0
Does using a (single) List or Array of multiple Extras work? eg something like: Code: Copy Dim LotsaStuff() As Object = Array As Object(ExtraPicture, ExtraSound, ExtraVideo) shortcutIntent.SetType("image/*") shortcutIntent.PutExtra("android.intent.extra.STREAM", LotasStuff) and then on the receiving side: Code: Copy Dim r As Reflector r.Target = StartIntent Dim LotsaStuff() As Object = r.RunMethod2("getParcelableExtra", "android.intent.extra.STREAM", "java.lang.String") 'presumably .String should be .Array or similar Dim bmp as Bitmap = LotsaStuff(0)