Android Question How to parse an intent bundle?

Discussion in 'Android Questions' started by NeoTechni, Jun 2, 2015.

  1. NeoTechni

    NeoTechni Well-Known Member Licensed 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= (has extras) },, 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:
    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?