App Quits Unexpectedly - No Crash

Hello.

I have an issue similar to this: https://forums.garmin.com/developer/connect-iq/f/discussion/7705/my-app-unexpectedly-ending-during-activity-for-my-vivoactive-3

I have 2 apps that I wrote. They both are designed to run indefinitely as long as the user does not quit the apps. After some time, the VivoActive 5 display goes to sleep as expected. Sometimes, I can wake up the watch by looking at it. When that does not work, I can usually wake it up by tapping once or twice. After many hours of operation, sometimes when I wake up the watch to see my apps, they are no longer running. Instead I see the watch face (the clock). At first I thought that this was a crash but there are no error logs.

Is it possible for an app to crash and not leave a log?

If not, then will the OS kill my app if it runs too long? Is there some sort of time limit?

If not, why would my app quit? I am pretty sure I am not right swiping to leave the app. I am only taping the display to wake it up.

Thank you

  • Anything to avoid even the suggestion of a Garmin bug

  • It could be a garmin bug, and adding println calls and logging could help to narrow things down and help with a bug report.

  • I added some logging as suggested like this:

    function onStop(state as Dictionary?) as Void {
            if (state != null) {
                var infoString = "onStop: " + state.toString();
                System.println(infoString);
            } else {
                System.println("onStop: null");
            }
        }

     function onInactive(state as Dictionary?) as Void {
            if (state != null) {
                var infoString = "onInactive: " + state.toString();
                System.println(infoString);
            } else {
                System.println("onInactive: null");
            }
        }
    I added the text file as instructed: /GARMIN/APPS/LOGS/MYAPP.TXT
    I then ran the app and locked the touch screen. At this point, it is not possible to leave the app by using the screen. There are no points in the app that programmatically exit or quit.
    After about only 20 minutes this time, the app quit and was at the watch face. There were no crash logs and there was no IQ! image. The application log had this:
    onInactive: null
    onStop: null
    To my knowledge, this means that the app did not crash, it exited properly, was not exited by the user, and was not exited by the app.
  • Could you add some timestamps? Maybe it's happening at the top of the hour, the top of the minute, or in some other predictable pattern?

    Just a random thought, but could the watch be killing the app because the pixels are on for too long and it wants to prevent burn-in?

  • Not sure what you are suggesting with regards to timestamps. Are you saying I should have a printline statement every minute and log the time to a file?

    As for the pixels being on too long, my app does not force the display to stay on. The watch turns off the display after a few seconds of not looking at it. I wake it up by tapping the display. It then shows the OS lock image, then shows my app.

  • Is your app recording a session?  What is it doing?  I'm running one of my apps that does nothing except for waiting for CIQ BLE data and displaying it, and on a va5, it's been running for a couple hours.  I'm wondering if there's some kind of limit on how long a non-activity app can run before the system shuts it down to preserve battery.  (a device app uses much more battery than a watch face)

    I've not seen that before, but I don't typically run non-activity apps for extended periods.

    I'd also comment out your onInactive() function, as I don't understand why you have it.

  • The app is not recording a session. It simply gets vitals (SpO2, HR, Stress Score, and RR), displays them on the screen, and sends them to the paired phone using the Toybox.Communications module to the paired phone running my Android app. Sometimes it runs for over a day, sometimes it runs 20 minutes, sometimes 10 hours. Random. 

    Are you saying that I should make this an activity app so that it can run indefinitely?

    One of my initial questions still remains though, can an app crash and not leave a log? If not, then there is no crash and the OS is forcing the app to quit.

    I have onInactive in there because someone here suggested to log things. It was not part of the original app and I have no other use for it. It has since been deleted.

  • Having an activity was just a guess on my part.

  • Are you saying that I should make this an activity app so that it can run indefinitely?

    That thought actually crossed my mind tbh bc CIQ apps are somewhat immune to exiting in certain ways if they’re recording an activity. For example, if I recall correctly, if you open a CIQ app, return to the watchface using a hotkey and start a native activity, that will terminate the app, at least on some devices. But if the app is recording, then you won’t be able to start the native activity until you return to the CIQ app and end the recording. I think there also was a sequence of actions that would just cause the app that’s recording to crash tho.

    Anyway I didn’t mention that idea bc you clearly don’t want to record an activity if you’re not already doing so. However, maybe you could just record an activity and discard it when the user decides to exit? The downsides are: increased battery consumption and the possibility that the app could crash if you record for a very long period of time (I haven’t seen this happen, nor have I tried to record a very long activity, but you never know what could happen.) Also, if the app crashes or the watch reboots/powers off, then you may have a half finished activity that might be synced to Connect (although the sync would probably fail.)

  • Should I file a bug report for CIQ?