Acknowledged
over 1 year ago

App Quits Unexpectedly

We are developing an app for the VivoActive 5 which uses many of Connect IQ's APIs including: Sensor, Communications, and SensorHistory. The app works very well with our Android application using your Android SDK.

The issue is that for no reason our application quits at random times. It is not an application crash because there is no crash log and there is no IQ! image. The user is not quitting the application because we have the screen locked. The application does not contain any exit() calls. OnInactive() and onStop() are both called which seems to me that the application has quit gracefully.

Please see the forum post for more information. It seems as though the OS is killing the application for no reason at random times. Sometimes the OS allows our app to run for 20 minutes, sometimes 20 hours. At some point, tapping the display to wake it up takes you to the watch face instead of the app because the OS has killed the app.

https://forums.garmin.com/developer/connect-iq/f/discussion/371444/app-quits-unexpectedly---no-crash?pifragment-1298=3#pifragment-1298=1

The people on the forum want to know if there is a Connect IQ bug or if this is intended behavior where the OS kills apps without warning.

  • Knowing the exact line that is causing the problem is likely enough for us to implement something of our own for testing. I was looking at the API documentation for enableSensorEvents and noticed an interesting note that says it will cause an app crash if called from a data field. There is probably a bug here assuming your app isn't a datafield.

  • Richard,

    Thank you for your help with this. We are able to send you our app (and source code if you wish) for testing. Are you able to provide your email, email me directly, or  provide a secure means for us to give you the app? We do not want to post the app to the public.

    I also have some updates. We have been trying to figure out what is causing the issue and we have discovered that 

    Sensor.enableSensorEvents(method(:onSensor)); is the issue. If we remove this and instead use SensorHistory to get the values we need, the app runs for several days with no problems.
    Thank you
  • I've been attempting to reproduce this on a vivoactive 5 without any luck. I've tried leaving various apps running on it for extended periods of time, but I haven't seen it go back to the watchface yet. I've been testing to see how easy it is to accidentally swipe back and close the app, but it doesn't seem that easy to do on accident and if there are no calls made to exit the app then that is probably not happening.

    I also don't think it is a multitasking problem if the user expects the app to show up upon waking the device which I believe means they never left the app at any point.

    Would you be able to supply an .IQ file of your app for further testing or a link to it on the store if it is uploaded there?

  • Hello. Just wondering if there are any updates to this issue. I have not been contacted yet. Thank you.

  • Thank you. To make sure it was not one of these limits you mentioned, I powered off the watch and powered it back on. Then from the apps menu, I ran my app. It lasted for 25 hours max and then quit. I ran it from the apps menu and not the glance menu as suggested by your docs:  

    "Apps will behave differently when they are launched from the glance list versus the activity menu. If an app is launched from the glance list, a timeout will be applied to the app. If the user does not exit the app within a given time frame, the system will terminate the app and return to the home screen. If an app is launched from the activity menu, however, it will not time out, and the user must explicitly exit your application."

    One thing to note is that my app is not an activity. I am launching it from the apps menu and not the activity menu and not the glance menu.