Links on Android Authority may earn us a commission. Learn more.
Is your Android Wear app randomly closing on you? Check this out
We’ve been keeping a close eye on Android Wear since it was first rumored and announced earlier this year. Not only are we huge fans of all mobile technology, including wearables like smartwatches, we’re also interested in how it all works and where it is headed in the future. We’ve stumbled across a little quirk in the Android Wear system that may be causing you, or at least the developers of your favorite Android Wear apps, some grief.
If your Android Wear app keeps closing unexpectedly, you are not alone.
Here is the scenario that developers are facing: when building a full screen Android Wear app that collects data from the accelerometer – this goes for many fitness related app out there – you may find that the app unexpectedly closes and returns you to the home screen of the device.
What is going on with that? The answer is pretty simple, Android Wear itself is also collecting accelerometer data, updating the pedometer step count. Android Wear is so exciting for your progress, it fires up a new info card and presents it to you on the home screen of your device.
As we keep tabs on this concern through the Android bug tracker, no official answers are available just yet. Perhaps developers are not supposed to build full screen apps for Android Wear that use the accelerometer, perhaps it is a bug, or maybe we’re just doing it wrong.
Luckily, the same user that filed the issue has a workaround. Developers, this is for you:
Instead of starting your app as a full screen activity, try creating a persistent notification in the context stream, then, give that notification an action to go full screen. This should prevent other cards from stopping your activity, so you can continue to collect accelerometer data and display it to your users.
We want to hear from you: Have you encountered an Android Wear app that closes unexpectedly? Are you a developer with any experience or insight into this particular situation, how did you overcome it?