The WearableListenerService service only starts after the application is installed - then never again

I am developing an Android app that supports Android Wear.

The main application sends data to the Android WearableListenerService wearing app, which then triggers a notification and displays it.

My problem is that if I restart Watch, the Android Wear application will never be launched again - since the listening service on the wearing device does not start from the mobile application!

I tried to close the application and start it again by rebooting the phone - no matter what I do, the hearing service can never be started again.

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

Has anyone had a similar problem or was aware of this?

So, I provide additional information:

When the watch loads, I wrote this message in the logs (which, apparently, is 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 is, what makes my application uninstall when the device starts?

+5
source share
1 answer

This Service does not work all the time - in fact, it works only during message processing. The Google Play Services Wear API is responsible for launching the WearableListenerService , so if it contains the correct IntentFilter installed in AndroidManifest , you don’t have to do anything.

+2
source

Source: https://habr.com/ru/post/1206798/


All Articles