首页 \ 问答 \ 谷歌云消息传递和推送通知设备?(google cloud messaging and push notification to device?)

谷歌云消息传递和推送通知设备?(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
更新时间:2023-06-29 19:06

最满意答案

经过一些谷歌搜索,我发现我需要在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 ...
  • 如果您的类都在特殊包或其任何子包中,例如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来执行inter-projectType构建编排。 但是你可以使用Gradle将其他projectType( maven或ant )转换为Gradle ,然后你可以开始在这些模块之间使用复合gradle build。 有了这个说法,如果你仍然需要它们,你可能必须为maven / ant模块维护两个构建工具。 注意复合构建的概念本质上是为了帮助跨项目开发(打算取代二进制依赖),实际上你需要全面使用Gradle 。 您提到的文档参考实际上是用于工件发布流程( maven-publi ...
  • 似乎有效的是重新运行: 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 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。