执行GCM客户端时发生未知错误和警告 [英] Unknown errors and warnings while implementing GCM client side
问题描述
我正在尝试实施 Github
,但无法在我的 MyGcmListenerService.java
当我通过在我的android studio logcat中生成的日志时,发现此警告和错误消息
警告 strong>
10-07 15:22:47.160 29844-29844 / com.me.myapp W / asset:AssetManager-- >
addDefaultAssets CIP路径不存在!
10-07 15:22:47.352 29844-29844 / com.me.myapp W / dalvikvm:VFY:无法解析
虚拟方法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:无法解析
实例字段18
10 -07 15:22:47.359 29844-29844 / com.me.myapp W / dalvikvm:VFY:无法解析
虚拟方法1507:Landroid / os / UserManager; .getApplicationRestrictions
(Ljava / lang /串;)Landroid / OS /束;
错误
10-07 15:03:37.070 10177-10177 / com.me.myapp E / dalvikvm:找不到类
'android.os.UserManager',引用自方法com.google.android.gms.common
.GooglePlayServicesUtil.zzah
10-07 15:03:37.156 10177-10177 / com.me.myapp E / dalvikvm:找不到类com.google.android.gms.common引用的
'android.app.AppOpsManager'。
GooglePlayServicesUtil.zzb
10-07 15:03:38.117 10177-10197 / com.me.myapp E / GMPM:getGoogleAppId失败,
状态:10
10-07 15:03:38.132 10177-10197 / com.me.myapp E / GMPM:上传是不可能的。
应用程序测量已禁用
10-07 15:07:11.320 10306-10306 / com.me.myapp E / SensorManager:线程启动
10-07 15 :07:17.164 10306-10703 / com.me.myapp E / API_TASK:读取超时
问题
- 如何解决部分或全部错误或警告?
- 它们是否与从GCM服务器收到通知失败有关? p>所述错误和问题与接收gcm通知无关。为我的情况。从gcm连接服务器收到的gcmid未保存在数据存储区中。负责保存它的实体实施得很糟糕,因此我没有收到来自GCM连接服务器的消息或通知。
-
确保从连接服务器收到的gcmId很好的保存在你的应用服务器中(我使用objectify来实现这一点)
类,以便在重要阶段通过打印日志(消息)来跟踪您的实现。例如当你收到gcmid(你可以在前端实现这个,因此使用 -
Log.d()
方法),如果gcmid已经保存到你的应用服务器上(这里你使用实体要做到这一点,它在这里你使用 Logger class
,因为这发生在后端模块)。 仍然陷入困境?下面的评论请求帮助
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 ?
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
这篇关于执行GCM客户端时发生未知错误和警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!