SDk 4.0.1 and ConnectIQ settings crash app

Hi,

New problem on latest release of my app using latest SDK. Sending settings to app works fine if app is running. If the app is not running then on the next restart it crashes almost immediately. Only solution is reinstall and lose all data (if only we could save app data...).

Simulator works fine.

The code has not changed in this part of the app for a long time and has always worked before.

Suggestions much appreciated

Regards,

David

  • Error: Unhandled Exception
    Time: 2021-05-21T06:40:43Z
    Part-Number: 006-B3291-00
    Firmware-Version: '16.60'
    Language-Code: eng
    ConnectIQ-Version: 4.0.1
    Store-Id: 1214076f-6114-4c9e-9e11-d66ad078cfe2
    Store-Version: 25
    Filename: B4OG3135
    Appname: HRV Analysis
    Stack:
    - pc: 0x10000a77
    - pc: 0x1000045b
    - pc: 0x10009644

    Just going to recompile and check where these are...

  • It seems to be back to failing to read a particular setting X after any of the settings are changed by ConnectIQ. The setting X property has a default (boolean) value which it reads fine in normal start up. If I change any of the settings in ConnectIQ the initial read of the app settings (using Properties.getValue() in the function called) of the particular key X fails with the UnhandledException which is not one of the two defined for this function.

    (in the past the ordering of the reads and the number of them seemed to make a difference to reads failing)

  • Does this property have an associated setting?  

    You may want to have it in a try/catch/

  • It does. I've just added some protective code so on first load all settings/store values are set to default. However simulator crashes when I try to delete all apps or app data. sigh. odd though it only fails if app is not running when ConnectIQ sends new values. If the app is running no issues.

  • (after lots of sim crashes .. you have to stop app before you can kill it or delete data or app)

    So I added try/catch and also forced initialisation of all properties on the first run of the app to make sure they exist and have valid values. All works fine in the simulator. 

    Uploaded a new version and low and behold exactly the same issue. Crash when app is not running. Fine if app is running. This time crash has moved to a different property read. smells like a ConnectIQ problem.

  • one thought.

    My app initialize function accesses resources and properties. Should this only be done in the onStart() function so is issue then a startup race in the OS?

  • If you have the background permission set, both AppBase initialize and onStart will be called when you might not expect.

  • thanks for the thought. No background permission. Is there any code that should not be executed in initialize() eg access to resources/reading properties?

  • taking all storage/properties code out of initialize() and moving to onStart() seems to have solved the crash on properties changing when app is not running. On a side note 4.0.2 leaves less room for the app on 128kB devices. Had to do various memory optimisations to make it run to completion.