How to pass parameters to a plugin

  • 1
  • Question
  • Updated 6 years ago
Hi, I'm trying to integrate a plugin in the build of my application but the plugin requires some configuration which it picks up (on Android) from a file in the res/values platform folder and it doesn't seem possible to customize the PGB build by adding, for example hooks which would let me populate that file properly.

I see in the PGB documentation that you can configure plugins in the config.xml file and pass them parameters and I'd like to modify the plugin so that it accepts these parameters, but I can't find any documentation about how exactly these parameters end up in the plugin. Are they constructor arguments to the plugin class or what exactly?
Photo of simone_b

simone_b

  • 4 Posts
  • 0 Reply Likes

Posted 6 years ago

  • 1
Photo of John Weidner

John Weidner, Champion

  • 435 Posts
  • 80 Reply Likes
I use the LaunchMyApp plugin https://github.com/EddyVerbruggen/Lau... from PGB and it has a URL_SCHEME parameter. Maybe you can study the code of that plugin to get an idea of how that is done.
Photo of simone_b

simone_b

  • 4 Posts
  • 0 Reply Likes
That's exactly what I was looking for, many thanks!
Photo of simone_b

simone_b

  • 4 Posts
  • 0 Reply Likes
Hi John, I looked at the code but apparently the parameter is only referenced in the plugin.xml file, where used as a preference and replaced via tokens in the same file. I'd need programmatic access to it.
Photo of John Weidner

John Weidner, Champion

  • 435 Posts
  • 80 Reply Likes
I think in his code, since there is just one parameter he gets the parameter value using: intent.getDataString().
Photo of simone_b

simone_b

  • 4 Posts
  • 0 Reply Likes
Yes, but it looks like a very special case as that's data that is passed to the intent, not a generic mechanism to pick up plugin parameters, which is what I'm after.
Photo of Eddy Verbruggen

Eddy Verbruggen, Champion

  • 375 Posts
  • 86 Reply Likes
Hi, if placing a file in res/values is what's you're after, then take a look at this plugin's plugin.xml: https://github.com/Telerik-Verified-P...

It moves the file 'crittercism.xml' to the res/values folder. Then it adds a string with a value substituted by a paramer ($ANDROID_APP_ID).

If that's still not what you're looking for, please provide a link to your plugin :)
Photo of Amir

Amir

  • 8261 Posts
  • 263 Reply Likes
Issue marked as resolved. Please create new topic if you require further assistant.

Thank you.

This conversation is no longer open for comments or replies.