florent37 / Wear-Emmet

Emmet is an protocol based data-transfer for Android Wear
http://florent37.github.io/Emmet
Apache License 2.0
41 stars 11 forks source link

Possible issue with singleton #14

Closed andkulikov closed 8 years ago

andkulikov commented 9 years ago

Hi! Why do you use singleton for Emmet? Emmet object lifecycle is the same as lifecycle of Context, passed in onCreate method. And if you have one Activity with Emmet to send events and one EmmetWearableListenerService in one moment they will try to use one emmet object. But after processing incoming message EmmetWearableListenerService will be destroyed and will call onDestroy of Emmet instance still used by Activity.