谷歌云消息传递和推送通知设备?(google cloud messaging and push notification to device?)
我需要知道并了解谷歌云消息传递用于将通知推送到设备的概念是什么。 我知道GCM检查每一分钟是否有等待的新消息,如果是谷歌将此消息推送到Android应用程序,我的问题是谷歌如何将此消息推送到特定的Android应用程序?
i need to know and understand what is the concept used by google cloud messaging to push notification to the device. I know that GCM check every some minute if there are new messages awaiting, if yes google push this message to android app, my question is how google push this message to the specific android app ?
原文:https://stackoverflow.com/questions/30095538
满意答案
经过一些谷歌搜索,我发现我需要在META-INF下创建aop.xml,并将aspectjweaver.jar添加到ant build.properties中的jvm选项。 由于我看到方法被截获,因此该方面似乎有效。 但我在启动时发现以下异常:
ERROR org.aspectj.weaver.bcel.BcelWorld - Unable to find class 'Object' in repository java.lang.ClassNotFoundException: Object not found - unable to determine URL at org.aspectj.apache.bcel.util.ClassLoaderRepository.loadClass(ClassLoaderRepository.java:292) ~[aspectjweaver.jar.0:1.7.3] at org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass(BcelWorld.java:402) [aspectjweaver.jar.0:1.7.3] at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate(BcelWorld.java:376) [aspectjweaver.jar.0:1.7.3] ...
我的@Aspect类看起来像这样:
@Aspect public class CaseInsensitiveEqualsAspect { @Pointcut("call(boolean equals(Object)) && args(compareString) && target(sourceString) && within(com.sample.package..*)") public void equalsPointcut(final Object compareString, final String sourceString) {} @Around("equalsPointcut(compareString, sourceString)") public Object around(final ProceedingJoinPoint joinPoint, final Object compareString, final String sourceString) throws Throwable { System.out.println(">>>>>>>>>>>>>>>>Invoking equalsIgnoreCase..."); return sourceString.equalsIgnoreCase(compareString != null ? compareString.toString() : null); } }
After some googling, I found that I need to create the aop.xml under META-INF and add the aspectjweaver.jar to the jvm options in ant build.properties. The aspect seems working since I saw the methods being intercepted. But I found below exception at startup:
ERROR org.aspectj.weaver.bcel.BcelWorld - Unable to find class 'Object' in repository java.lang.ClassNotFoundException: Object not found - unable to determine URL at org.aspectj.apache.bcel.util.ClassLoaderRepository.loadClass(ClassLoaderRepository.java:292) ~[aspectjweaver.jar.0:1.7.3] at org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass(BcelWorld.java:402) [aspectjweaver.jar.0:1.7.3] at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate(BcelWorld.java:376) [aspectjweaver.jar.0:1.7.3] ...
My @Aspect class looks like this:
@Aspect public class CaseInsensitiveEqualsAspect { @Pointcut("call(boolean equals(Object)) && args(compareString) && target(sourceString) && within(com.sample.package..*)") public void equalsPointcut(final Object compareString, final String sourceString) {} @Around("equalsPointcut(compareString, sourceString)") public Object around(final ProceedingJoinPoint joinPoint, final Object compareString, final String sourceString) throws Throwable { System.out.println(">>>>>>>>>>>>>>>>Invoking equalsIgnoreCase..."); return sourceString.equalsIgnoreCase(compareString != null ? compareString.toString() : null); } }
相关问答
更多使用Ant构建Android库项目(Build Android Library Project With Ant)
Gradle和AspectJ - 避免在编译期间编织我自己的包(Gradle and AspectJ - avoid weaving my own packages during compile time)
Gradle Composite用不同的项目类型构建(ant,maven)(Gradle Composite Build with different project types (ant, maven))
Android测试项目无法在Ant下构建,在Eclipse中正常(Android test project fails to build under Ant, OK in Eclipse)
如何使用Ant使用AspectJ构建项目(How to build project with AspectJ using Ant)
gradle + aspectj - 编译错误编织外部jar(gradle + aspectj -— compile error weaving external jar)
设置Ant项目名称而不更改构建文件(Setting Ant project name without changing build file)
如何使用ant构建具有依赖关系的多个项目(How to build several projects with dependencies using ant)
为我的web项目使用ant build(Using ant build for my web project)
使用Ant / Maven构建Android项目(Building the Android Project using Ant/Maven)
相关文章
更多nslocal notification
Storm-源码分析- Messaging (backtype.storm.messaging)
HTML5 Notification 桌面提醒功能 API
Mercurial 如何让中央库在每次被push新内容后都自动update?
Struts2 Push Tag 引发的问题
opensource projects relevant version of cloud
android Failed to install .apk on device 'emulator-5554': timeout的解决方案
tomcat中搭建solr Cloud、日志、多Core以及常见问题
Cloud7为全球移动互联网大会提供手机门户支撑
最新问答
更多您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
在计算机拍照在哪里进入
使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
单页应用程序:页面重新加载(Single Page Application: page reload)
在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!