问题
I'm trying to implement GCM client example found at Github but am not able to recelve notifications in my MyGcmListenerService.java
when i go through logs generated at my android studio logcat, i find this warnings and error messages
Warnings
10-07 15:22:47.160 29844-29844/com.me.myapp W/asset﹕ AssetManager-->
addDefaultAssets CIP path not exsit!
10-07 15:22:47.352 29844-29844/com.me.myapp W/dalvikvm﹕ VFY: unable to resolve
virtual method 247: Landroid/app/Notification$Builder;.setLocalOnly (Z)
Landroid/app/Notification$Builder;
10-07 15:22:47.352 29844-29844/com.me.myapp W/dalvikvm﹕ VFY: unable to resolve
instance field 18
10-07 15:22:47.359 29844-29844/com.me.myapp W/dalvikvm﹕ VFY: unable to resolve
virtual method 1507: Landroid/os/UserManager;.getApplicationRestrictions
(Ljava/lang/String;)Landroid/os/Bundle;
Errors
10-07 15:03:37.070 10177-10177/com.me.myapp E/dalvikvm﹕ Could not find class
'android.os.UserManager', referenced from method com.google.android.gms.common
.GooglePlayServicesUtil.zzah
10-07 15:03:37.156 10177-10177/com.me.myapp E/dalvikvm﹕ Could not find class
'android.app.AppOpsManager', referenced from method com.google.android.gms.common.
GooglePlayServicesUtil.zzb
10-07 15:03:38.117 10177-10197/com.me.myapp E/GMPM﹕ getGoogleAppId failed with
status: 10
10-07 15:03:38.132 10177-10197/com.me.myapp E/GMPM﹕ Uploading is not possible.
App measurement disabled
10-07 15:07:11.320 10306-10306/com.me.myapp E/SensorManager﹕ thread start
10-07 15:07:17.164 10306-10703/com.me.myapp E/API_TASK﹕ Read timed out
Question
- how can i solve some or all or of this errors and warnings?
- Do they have to do with my failure to receive notifications from GCM server ?
回答1:
The stated errors and problems have nothing to do with receiving gcm notifications. for my case. gcmid received from gcm connection server wasn't being saved at datastore. the entity responsible for saving it was badly implemented thus i coundn't receive messages or notifications from GCM Connection servers.
Make sure gcmId received from connection servers is well saved in your app server.(i use objectify to achieve this)
Also make use of
Logger
class at your backend module in order to track your implementation by printing out logs(messages) at important stages. e.g when you receive gcmid (you can implement this at the frontend thus useLog.d()
method), if gcmid have been saved to your app server( here you use entities to do that and its here where you useLogger class
because this takes place at backend module).
Still stucked? comment below to ask for help
来源:https://stackoverflow.com/questions/32992387/unknown-errors-and-warnings-while-implementing-gcm-client-side