Android Question How to parse an intent bundle?

NeoTechni

Well-Known Member
Licensed User
Longtime User
I finally managed to get my launcher to receive new shortcut requests from other apps, but I don't know how to parse the extra data

Examples of StartingIntent.ExtrasToString are:
Bundle[{duplicate=false, android.intent.extra.shortcut.NAME=Screen off shortcut, android.intent.extra.shortcut.ICON_RESOURCE=com.nkahoang.screenstandby:drawable/ic_launcher}]

Bundle[{android.intent.extra.shortcut.INTENT=Intent { act=android.intent.action.VIEW dat=http://warnersretrocorner.com/wp-co...t-Poster-Nes-Conan-barbarian-190876195313.jpg pkg=com.android.chrome (has extras) }, android.intent.extra.shortcut.ICON=android.graphics.Bitmap@1361edb0, android.intent.extra.shortcut.NAME=A3-80s-Replica-Reproduction-Video-Game-PRINT-Box-Art-Poster-Nes-Conan-barbarian-190876195313.jpg (290×400)}]

Erel once gave me this code to parse a widget size bundle:
B4X:
Dim jintent As JavaObject = StartingIntent
Dim widgetOptions As JavaObject = jintent.RunMethod("getBundleExtra", array As Object("appWidgetOptions"))
Log(widgetOptions.RunMethod("getInt", Array As Object("appWidgetMaxHeight")))

I assume the code is similar, just replacing appWidgetOptions with a magic string I don't know about, and getInt with getIntent/getIcon/getString?
 
Top