谷歌云消息传递和推送通知设备?(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);
    }
}

相关问答

更多

使用Ant构建Android库项目(Build Android Library Project With Ant)

然后我认为可能库不能通过发布/调试来构建 正确。 我猜这是错误的做法。 也是正确的。 任何人都可以告诉我如何使用蚂蚁建立一个Android库项目? 您通常不会构建Android库项目。 您可以构建引用Android库项目的其他项目。 Android文档中介绍了创建引用库项目以供Ant使用的项目。 有关Android库项目角色的更多信息也可以在Android文档中找到。 I then assumed that perhaps libraries do not get build with relea...

Gradle和AspectJ - 避免在编译期间编织我自己的包(Gradle and AspectJ - avoid weaving my own packages during compile time)

如果您的类都在特殊包或其任何子包中,例如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 ...

Gradle Composite用不同的项目类型构建(ant,maven)(Gradle Composite Build with different project types (ant, maven))

我不认为你可以使用Gradle来执行inter-projectType构建编排。 但是你可以使用Gradle将其他projectType( maven或ant )转换为Gradle ,然后你可以开始在这些模块之间使用复合gradle build。 有了这个说法,如果你仍然需要它们,你可能必须为maven / ant模块维护两个构建工具。 注意复合构建的概念本质上是为了帮助跨项目开发(打算取代二进制依赖),实际上你需要全面使用Gradle 。 您提到的文档参考实际上是用于工件发布流程( maven-...

Android测试项目无法在Ant下构建,在Eclipse中正常(Android test project fails to build under Ant, OK in Eclipse)

似乎有效的是重新运行: 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...

如何使用Ant使用AspectJ构建项目(How to build project with AspectJ using Ant)

经过一些谷歌搜索,我发现我需要在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 no...

gradle + aspectj - 编译错误编织外部jar(gradle + aspectj -— compile error weaving external jar)

我终于解决了^ _ ^。 由于我的项目有多模块,所以我将aspectj配置文件移动到根模块。最后的gradle脚本是: buildscript { repositories { maven { url "http://nexus.**.org/nexus/content/groups/public/" } } dependencies { classpath("nl.eveoh:gradle-aspectj:1.5") } } ex...

设置Ant项目名称而不更改构建文件(Setting Ant project name without changing build file)

如果您不需要在同一窗口中实际编辑来自所有分支的代码,则可以始终创建和管理多个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 e...

如何使用ant构建具有依赖关系的多个项目(How to build several projects with dependencies using ant)

您可以将常春藤构建列表任务与子服务器相结合,以基于依赖关系以正确的顺序构建子项目。 请参阅以下答案以获取示例: 常春藤简单的共享存储库 使用这种方法,可以在不切换构建工具的情况下重新创建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...

为我的web项目使用ant build(Using ant build for my web project)

任何一种自动化方式都可以帮助您提高生产力。 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 /...

使用Ant / Maven构建Android项目(Building the Android Project using Ant/Maven)

您不需要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 wan...

相关文章

更多

nslocal notification

notification.alertBody = [NSString stringWithFormat ...

Storm-源码分析- Messaging (backtype.storm.messaging)

先定义两个接口和一个类 TaskMessage类本身比较好理解, 抽象storm的message格式 ...

HTML5 Notification 桌面提醒功能 API

桌面通知功能能够让浏览器即使是最小化状态也能将消息通知给用户。这和WebIM是最为天然的结合。不过,目 ...

Mercurial 如何让中央库在每次被push新内容后都自动update?

我在一台服务器上有个仓库,并开启web server 我希望,在其他机器往这台服务器push内容后, ...

Struts2 Push Tag 引发的问题

按照Struts官网上的CRUD例子,自己实践了一下,结果报错: tag 'push', field ...

opensource projects relevant version of cloud

hadoop-0.20.2 hbase-0.20.6 hive-0.6.0-bin pig-0.7. ...

android Failed to install .apk on device 'emulator-5554': timeout的解决方案

eclipse输出Failed to install HelloWorld.apk on device ...

tomcat中搭建solr Cloud、日志、多Core以及常见问题

solr版本:4.5.1 1、搭建solrCloud 搭建参照这个网址: http://blo ...

Cloud7为全球移动互联网大会提供手机门户支撑

北京时间5月7日,2013全球移动互联网大会(GMIC)在国家会议中心正式召开。8000名移动互联网从 ...

最新问答

更多

您如何使用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?)

将diff文件复制到存储库的根目录,然后执行以下操作: git apply yourcoworkers.diff 有关apply命令的更多信息, apply 见其手册页 。 顺便说一下:一个更好的方法是通过文件交换整个提交文件是发送者上的命令git format-patch ,然后在接收器上加上git am ,因为它也传送作者信息和提交信息。 如果修补程序应用程序失败,并且生成diff的提交实际上在您的备份中,则可以使用尝试在更改中合并的apply程序的-3选项。 它还适用于Unix管道,如下

将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)

尝试将第二行更改为snprintf(buf1, sizeof buf1, "%.2f", balance1); 。 另外,为什么要声明用该特定表达式分配缓冲区的存储量? EDIT @LưuVĩnhPhúc在下面的评论中提到我的原始答案中的格式说明符将舍入而不是截断,因此根据如何在不使用C舍入的情况下截断小数,您可以执行以下操作: float balance = 200.56866; int tmp = balance1 * 100; float balance1 = tmp / 100.0; c

OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)

这是简单的解决方案 在你需要写的控制器中 BackendMenu::setContext('Archetypics.Team', 'website', 'team'); 请参阅https://octobercms.com/docs/backend/controllers-views-ajax#navigation-context BackendMenu::setContext('Author.Plugin name', 'Menu code', 'Sub menu code'); 你需要在r

页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)

每当发出请求时ASP都会创建一个新的Page对象,并且一旦它将响应发送回用户就不会保留对该Page对象的引用,因此只要你找不到某种方法来保持生命自己引用该Page对象后,一旦发送响应, Page和只能通过该页面访问的所有对象才有资格进行垃圾回收。 ASP creates a new Page object whenever a request is made, and it does not hold onto the reference to that Page object once it

codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)

要在生产服务器中调试这个,你可以临时放 error_reporting(E_ALL); 并查看有哪些其他错误阻止正确的重定向。 您还应该检查生产服务器发送的响应标头。 它是否具有“缓存”,是否需要重新验证标头等 to debug this in production server, you can temporary put error_reporting(E_ALL); and see what other errors are there that prevents the proper

在计算机拍照在哪里进入

打开娥的电脑.在下面找到视频设备点击进去就可以了...

使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)

你是对的。 第一次输入后,换行符将保留在输入缓冲区中。 第一次读取后尝试插入: cin.ignore(); // to ignore the newline character 或者更好的是: //discards all input in the standard input stream up to and including the first newline. cin.ignore(numeric_limits::max(), '\n'); 您必须为#inc

No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)

for (int k = 0; k > 10; k++) { System.out.println(k); } k不大于10,所以循环将永远不会执行。 我想要什么是k<10 ,不是吗? for (int k = 0; k < 10; k++) { System.out.println(k); } for (int k = 0; k > 10; k++) { System.out.println(k); } k is not greater than 10, so loop

单页应用程序:页面重新加载(Single Page Application: page reload)

优点是不注销会避免惹恼用户,以至于他们会想要杀死你:-)。 说真的,如果每次刷新页面时应用程序都会将我注销(或者在新选项卡中打开一个链接),我再也不会使用该应用程序了。 好吧,不要这样做。 确保身份验证令牌存储在刷新后的某个位置,即不在某些JS变量中,而是存储在cookie或本地存储中。 The advantage is that not logging off will avoid pissing off your users so much that they'll want to kill

在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)

EXECUTE IMMEDIATE 'SELECT '||field_val_temp ||' FROM tableb WHERE function_id = :func_val AND rec_key = :rec_key' INTO field_val USING 'STDCUSAC' , yu.rec_key; 和, EXECUTE IMMEDIATE 'UPDATE tablec SET field_val_'||i||' = :field_val' USI