首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ADM客户端未接收的消息

ADM客户端未接收的消息
EN

Stack Overflow用户
提问于 2014-11-29 06:32:29
回答 1查看 459关注 0票数 0

我正试图将SNS消息发送到firephone,而当我似乎在向某个地方发送消息时,似乎没有什么东西能接通我的Firephone。

我能够使用文档中的代码来创建KindleMobilePushApp,能够生成一个RegistrationID,我为测试应用程序创建了安全配置文件,等等。我假设如果我获得注册ID,我一定做对了一些事情。

然后我试着向手机发送一条信息,使用Kindle演示应用程序接收消息,但似乎什么都没有得到,onMessage的ADMHandler方法从来没有被调用过。

我试着通过AWS控制台和文档(sns.samples.mobilepush)中提供的java应用程序发送消息,这个Java应用程序似乎发布了一些东西,但是再次强调,它没有通过我的firephone,或者至少没有被我的接收类接收到。

我以前从未使用过SNS,所以我不知道问题是从哪里来的,是我没有发送到正确的端点,还是我的应用程序没有收到它应该收到的消息。CloudWatch为“发布的消息”和“消息失败”报告了相同的号码,但实际上不知道消息发生了什么。

有什么我该去找的吗?在清单下面,并发布来自java发件人程序的结果。

代码语言:javascript
复制
<!-- Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.  -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at -->
<!--     http://aws.amazon.com/apache2.0/ -->
<!-- or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:amazon="http://schemas.amazon.com/apk/res/android"
    package="com.grapevine.snstest"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="17" />

   <!-- This permission ensures that no other application can intercept your ADM messages. It
   should have the form packagename.permission.RECIEVE_ADM_MESSAGE where packagename is the
   name defined in the "package" property of the manifest tag. --> 
    <permission android:name="com.grapevine.snstest.permission.RECEIVE_ADM_MESSAGE"
        android:protectionLevel="signature"/>

    <!-- Required permissions -->
    <uses-permission android:name="com.grapevine.snstest.permission.RECEIVE_ADM_MESSAGE"/>
    <uses-permission android:name="com.amazon.device.messaging.permission.RECEIVE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"        
        android:theme="@style/AppTheme" >
        <uses-permission android:name="com.grapevine.snstest.permission.RECEIVE_ADM_MESSAGE"/>
        <activity
            android:name="com.grapevine.snstest.KindleMobilePushApp"
            android:screenOrientation="portrait"
            android:label="@string/title_activity_main"
            android:launchMode="singleTop" >
            <uses-permission android:name="com.grapevine.snstest.permission.RECEIVE_ADM_MESSAGE"/>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Your application's API Key -->
        <!--<meta-data android:name="AmazonAPIKey" android:value="@string/api_key"/>-->

        <!--  Declare your ADMMessageHandlerBase implementation as a service -->
        <service android:name="com.grapevine.snstest.ADMMessageHandler"
            android:exported="false" />

        <!-- You must explicitly enable ADM. You must also declare whether your application will run with or without ADM.
        If you specify android:required="false", your app must degrade gracefully when ADM is unavailable. -->
        <amazon:enable-feature android:name="com.amazon.device.messaging" 
            android:required="true" />

        <receiver android:name="com.grapevine.snstest.ADMMessageHandler$MessageAlertReceiver"
                  android:permission="com.amazon.device.messaging.permission.SEND">
            <uses-permission android:name="com.grapevine.snstest.permission.RECEIVE_ADM_MESSAGE" />
            <intent-filter>
               <action android:name="com.amazon.device.messaging.intent.REGISTRATION" /> 
               <action android:name="com.amazon.device.messaging.intent.RECEIVE" /> 
               <category android:name="com.grapevine.snstest"/>
            </intent-filter>
        </receiver>       
    </application>

</manifest>

下面是我使用MobilePushApp示例程序时的输出:

代码语言:javascript
复制
===========================================

Getting Started with Amazon SNS
===========================================

{PlatformApplicationArn: arn:aws:sns:us-west-2:308914227153:app/ADM/SNSTest}
{EndpointArn: arn:aws:sns:us-west-2:3089xxx53:endpoint/ADM/SNSTest/66xxxf-1f06-3xx1-b887-fxxxxbe19}
{Message Body: {"ADM":"{\"data\":{\"message\":\"Hello World! \"},\"expiresAfter\":1000,\"consolidationKey\":\"Welcome\"}"}}
{Message Attributes:}
Published! 
{MessageId=90f09248-e65b-5713-a6da-debb8e5afcef}

Process finished with exit code 0
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-02 03:20:06

喔,这不起作用,因为开发者门户中的应用程序上没有启用SNS消息传递。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27199605

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档