json from resource

1. There is no documentation only one example...

2. It's from 2.3 CIQ but for all device?

3. How it works?

-  what is returned from loadResource(resourceId_jsonres)? dictionary?

- memory usage. After loading json_res in function to local var is memory released after exiting from func? or happens something like with string_res - memory is occupied until app exit?

  • Compile tine, use jungles, runtime, use monkeyVersion.  Depending on how you do things, maybe both

  • I love when you state the obvious but ignore the missing information that would be needed to generate the jungles (that we were talking about)

  • It's easy to see even if there's no specific doc for it.  Just look at the manifest.xml for the jsondata sample in the SDK, and you see 

    minSdkVersion="2.3.0"
    That also determines what target devices can be be seen/used for the app.
    And if you change this to include CIQ1 devices and add a CIQ 1 device, you see something like this:

    ERROR: vivoactive: C:\Users\James\workspace-prod\JsonDataResources\resources\jsonData\jsonResources.xml: JSON resources are not supported by device 'vivoactive'. 
  • ERROR: vivoactive: C:\Users\James\workspace-prod\JsonDataResources\resources\jsonData\jsonResources.xml: JSON resources are not supported by device 'vivoactive'.

    How do you selectively exclude an xml resource file using a jungle for the older devices? Having to include it instead for every new device that comes along would be a pain to maintain.

  • resourcePathNew = resources-new
    
    resourcePathOld = resources-old
    
    base.resourcePath = $(resourcePathNew)
    fr230.resourcePath = $(resourcePathOld)
    ... all the OLD devices need to be listed here

  • So, two identical sets of resource files except that "old" has one file that has "strings" instead of "jsonData". Maybe there is a way to do this with jungle variables but I don't see how to conditionally set one. Basically, there just isn't a simple way to NOT do something.

  • I need to do something similar with apps that publish complications.  There's an xml file that can only be referenced on devices that have complications, but is required to publish.

    One line in my jungle file for a device that can publish.

  • In my case resources-new, resources-old are directories. Though you can try, many it also works if you set filenames.

    I don't understand you problem about "not doing something" You wanted not to need to edit the jungle every time a new device is added. I gave you an example to that. You only need to edit the file once (now), and never need to add new devices (unless there's going to be one that doesn't support jsonData which is unlikely)

    In my case I generate the jungle with my script: https://github.com/flocsy/garmin-dev-tools/blob/main/monkey-generator/monkey-generator.py but it's under heavy development at the moment. I added recently a feature (not yet in github) where I can state things like these in my monkey.template.jungle:

    monkey_generator_filter_device_has = toCharArray
    monkey_generator_filter_device_min_ciq = 2.3.0 # jsonData
    This would filter the devices in the SDK by the conditions:
    1. only include devices that have the toCharArray method
    2. only include devices that have min CIQ version at least 2.3.0
    The latter one is the reason I asked it how we know that jsonData is really from CIQ 2.3.0.
    With these settings I just run my script: monkey-generator.py and it generated monkey.jungle.
    Every time a new device is added or even if an update to any device was downloaded in the SDK manager I just re-run my generator.
  • So, you decided to develop a tool to deal with this problem because solving the problem manually would be a pain whenever new devices are added. I'm pretty sure that's what I was saying. I'll just keep doing it the hard way. One resource file for everyone, and a dozen lines of code to parse a string into an array that only needs to run at app start.

  • How many apps so you have? The time you're wasting on writing the same thing again and again instead of reading what I wrote probably is more than what you would spend on editing all your jungles every time a new device is added. But if you would read and understand what I wrote you would only need to do it once.