Battery Charging BUG

The Battery Charging flag is a new SDK 3.x feature.

// if(sysST has :charging) { if(sysST.charging != null) { mBATC = sysST.charging; } }

On the Edge 520, SDK 2.4.x. Battery Charging returns 0 regardless of the Battery Charging setting in the simulator.
On the Edge 820, SDK 2.4.x. Battery Charging returns true or false depending on the Battery Charging setting in the simulator.

I'm guessing it should return 0 under SDK 2.4.x and only work (returning true or false) under SDK 3.x?


  • You don't need that null check, as it will be true or false.

    What are you setting mBATC to in the event the has check is false? That could be where the 0 is coming from:
    var mBATC=0; //set this to false instead
    if(sysST has :charging) {mBATC=sysST.charging;}

    would cause it.

    Defaulting mBATC to false would resolve it.
    Looks like the has check is false on the 520 and true on the 820, but charging isn't documented as supported until CIQ3.0.0, but maybe be there on the 820 with 2.4.x
  • According to the code, this should only ever be a boolean value. I'm betting Jim is right and your has check is returning false on the 520, and you're not assigning to mBATC.
  • According to the code, this should only ever be a boolean value. I'm betting Jim is right and your has check is returning false on the 520, and you're not assigning to mBATC.


    Yep! You guys know your stuff (and I don't) :-)

    I set an "enum { FALSE TRUE }" which I don't need since true/false are native values.

    so the 0 value is my fault. And the fact that it doesn't return a true/false on the 520 under the SDK 2.4.x but does return a true/false under the same SDK on the 820 (a 3.x compatible device), seems like a possible but low priority issue.
  • On the 520 the "has" is likely false , so the mBATC=sysST.charging is never being executed with that device.

    As "charging" is "since 3.0.0" and the 520 will remain on CIQ2, it's not an issue. It's working as documented. That's why the has check is needed - for devices without "charging".

    I just verified with one of my apps that the 820 "has" charging, and the 520 doesn't.
  • Not a big deal... but my point is that the battery charging logic is working correctly on an 820 device in the simulator when you pick SDK 2.4.x. That's all I was really saying. And I would expect it to not work until you pick SDK 3.x. Again, this is NO BIG DEAL. But possibly for consistency with the documentation and with the device, that might be interesting. Thx!
  • Honestly, I hate to say it, but I don't know what the Target SDK Version field in the Run Configurations dialog does or is supposed to do. It seems that it should do what you are suggesting, but I don't see how the current implementation could support this. Chances are good that this is a bug.

    That said, if you print the ConnectIQ version from System.getDeviceSettings(), you'll see that it is 3.0.0 for the 820 (the value from bin/devices.xml).
  • Hi Travis,

    Just picking up on what you said about "Target SDK Version" in Run configurations - and sorry to hijack the thread... My app is built for the Edge devices and my manifest file specifies a min SDK version of 2.4.0 because that's the latest that the Edge520 will support going forwards, apparently. This presents a problem when building for the Edge520Plus, which expects a min version of 3.x. I thought I could use the "Target SDK Version" to address this, but as you've pointed out it does nothing. Is there a way to override the min SDK version in the manifest file? Or, can I specify a different manifest file, in the jungle file, for this particular device (edge520plus)? When I attempt to "run" my app for the 520plus device, i see this message and the build fails:

    BUILD: ERROR: Unable to find exact match for target SDK version: 2.4.0 using device: edge520plus


    Thanks,
    Rob.
  • Use eclipse to make changes like this, as the proper way to specify it is a version of 2.4.x.

    But more importantly why are you changing it? All my apps still have a min of 1.2.x. After that, you can refine/restrict things by which targets you specify, using jungles, and a "has" where needed.

    if you don't have any CIQ1 targets for your app, just leaving it at 1.2.x should work just fine with no changes, for example.
  • Thanks Jim.

    Yeah, in Eclipse when you use the manifest editor it shows versions as 2.4.x, 1.2.x, etc, but when they are written into the manifest file they are written as "2.4.0", "1.2.0", etc. I set my min version to 2.4.0 because that's the version I started developing with and I didn't want to support older versions.


    Cheers,
    Rob.
  • As I said, you can do that by limiting the targets you support. No need to set it in the manifest. Yes, you're right about the 2.4.x and 2.4.0, but never changed it from 1.2.0 myself!

    If you only want to support CIQ2 and CIQ3 devices, only have those devices as targets when you build The only CIQ2 device I see that doesn't have 2.4.0 or greater is the APAC Oregon 7xx.