Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WearableListenerService only starting after application is installed - then never again

I'm developing an Android applciation with Android Wear support.

The main application sends data to Android wear apps WearableListenerService, that then makes a notification and displays it.

My problem is that if I restart the Watch, the Android Wear app can never be started again - since the listener service on the wear device doesnt start with the mobile app!

I have tried force closing the app and start it again, reboot the phone - no matter what I do the listenerservice can never be started again.

It works perfectly when I install the app from Android Studio, and it will work until the watch is restarted. (I can reboot the phone and close the app)

Have anyone had a similar problem or know a solution to this?

So I'm providing some more info:

When the watch boots up, I captured this message in the logs (which is apparently the root of the problem):

11-27 17:22:08.974      803-830/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Sent delete request for com.example.distributedmediaplayer
11-27 17:22:09.074      473-509/system_process I/ActivityManager﹕ Force stopping com.example.distributedmediaplayer appid=10032 user=-1: uninstall pkg
11-27 17:22:09.084      473-517/system_process W/PackageManager﹕ Couldn't delete native library directory /data/app-lib/com.example.distributedmediaplayer
11-27 17:22:09.274      473-517/system_process I/ActivityManager﹕ Force stopping com.example.distributedmediaplayer appid=10032 user=0: pkg removed
11-27 17:22:09.574      803-814/com.google.android.clockwork.packageinstaller I/WearablePkgInstaller﹕ Package com.example.distributedmediaplayer was uninstalled.
11-27 17:22:44.721    1166-1182/android.process.acore D/VoicemailCleanupService﹕ Cleaning up data for package: com.example.distributedmediaplayer
11-27 17:22:44.891      637-637/com.google.android.gms I/ConfigFetchService﹕ PackageReceiver: Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.distributedmediaplayer flg=0x4000010 cmp=com.google.android.gms/.config.ConfigFetchService$PackageReceiver (has extras) }
11-27 17:22:44.901      637-637/com.google.android.gms I/ConfigFetchService﹕ onStartCommand Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.distributedmediaplayer cmp=com.google.android.gms/.config.ConfigFetchService (has extras) }

So the question becomes, what makes my application uninstall when the device starts?

like image 674
Joakim Avatar asked Oct 31 '22 14:10

Joakim


1 Answers

This Service is not running all the time - in fact, it's running only during messages processing. Google Play Services Wear API is responsible for starting your WearableListenerService, so as long as it contains correct IntentFilter set up in AndroidManifest you don't have to do anything special.

like image 105
Dmitry Zaytsev Avatar answered Nov 15 '22 03:11

Dmitry Zaytsev