谷歌云消息传递和推送通知设备?(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); } }
相关问答
更多-
然后我认为可能库不能通过发布/调试来构建 正确。 我猜这是错误的做法。 也是正确的。 任何人都可以告诉我如何使用蚂蚁建立一个Android库项目? 您通常不会构建Android库项目。 您可以构建引用Android库项目的其他项目。 Android文档中介绍了创建引用库项目以供Ant使用的项目。 有关Android库项目角色的更多信息也可以在Android文档中找到。 I then assumed that perhaps libraries do not get build with release/de ...
-
Gradle和AspectJ - 避免在编译期间编织我自己的包(Gradle and AspectJ - avoid weaving my own packages during compile time)[2023-08-31]
如果您的类都在特殊包或其任何子包中,例如my.company.blah ,只需将其添加到您的切入点: && !within(my.company.blah..*) The problem is solved by: first compiling the code then adding the aspectj compilation with the specific classpath and sources. This means that instead of implementing compi ... -
Gradle Composite用不同的项目类型构建(ant,maven)(Gradle Composite Build with different project types (ant, maven))[2023-07-22]
我不认为你可以使用Gradle来执行inter-projectType构建编排。 但是你可以使用Gradle将其他projectType( maven或ant )转换为Gradle ,然后你可以开始在这些模块之间使用复合gradle build。 有了这个说法,如果你仍然需要它们,你可能必须为maven / ant模块维护两个构建工具。 注意复合构建的概念本质上是为了帮助跨项目开发(打算取代二进制依赖),实际上你需要全面使用Gradle 。 您提到的文档参考实际上是用于工件发布流程( maven-publi ... -
Android测试项目无法在Ant下构建,在Eclipse中正常(Android test project fails to build under Ant, OK in Eclipse)[2023-09-20]
似乎有效的是重新运行: android update test-project -m ../../app_project/ -p . 在测试项目中。 它唯一的变化是创建一个带有一个非注释行的ant.properties文件: tested.project.dir=../../app_project/ 而现在它在Eclipse之外游泳了! What seems to work is to re-run: android update test-project -m ../../app_project/ -p ... -
经过一些谷歌搜索,我发现我需要在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 fou ...
-
我终于解决了^ _ ^。 由于我的项目有多模块,所以我将aspectj配置文件移动到根模块。最后的gradle脚本是: buildscript { repositories { maven { url "http://nexus.**.org/nexus/content/groups/public/" } } dependencies { classpath("nl.eveoh:gradle-aspectj:1.5") } } ext { ...
-
如果您不需要在同一窗口中实际编辑来自所有分支的代码,则可以始终创建和管理多个Eclipse工作区。 为每个分支创建一个工作区。 这可能会解决您的问题。 If you don't need to actually edit code from all of the branches in the same window, you could always create and manage multiple Eclipse workspaces. Create one workspace for each b ...
-
您可以将常春藤构建列表任务与子服务器相结合,以基于依赖关系以正确的顺序构建子项目。 请参阅以下答案以获取示例: 常春藤简单的共享存储库 使用这种方法,可以在不切换构建工具的情况下重新创建Maven的工作方式。 You can combine the ivy buildlist task with subant to build the sub-projects in the correct order, based on dependencies. See the following answer for ...
-
任何一种自动化方式都可以帮助您提高生产力。 Ant是一个可以尝试的工具。 我怀疑你需要的是一些项目自动化 /持续集成。 像Jenkins / Judson这样的工具可以帮到那里。 Any kind of automated way helps you to increase productivity. Ant is one tool that could and you should try. I suspect what you need is some project automation / cont ...
-
您不需要Maven来构建Android应用程序。 你确实需要Ant或Eclipse。 这是创建Android项目的基本培训指南。 如果你想使用Maven,你可以。 这里有一个受欢迎的maven插件,附带说明 。 You don't need Maven to build Android apps. You do need Ant, or Eclipse. Here's a basic training guide to creating an Android project. If you want to ...