【问题标题】:Push not working with Parse-server hosted on Localhost/amazon beanstalkPush 不适用于托管在 Localhost/amazon beanstalk 上的 Parse-server
【发布时间】:2016-07-18 20:34:31
【问题描述】:

在我的 AfterSave 中,我发起了推送,我可以看到 CloudCode 中打印了 Success 语句,但我的 IOS 或 Android 设备上没有收到任何内容。

这里是Cloudcode

    function senderPush(instalationId, receiverName, receiverNumber, message, status ) {
    var query = new Parse.Query(Parse.Installation);
    query.equalTo("installationId", instalationId);
    Push.send({
        where: query,
        data: {
            header: "Status : " + status ,
            ...
            badge: "Increment",
            message : message,
            status : status,
        }
    },{
        success: function() {
            console.log("notification sent");
        },
        error: function(error) {
            console.log("Error sending senderPush: " + error);
        },
        useMasterKey: true
    });
    }

这里是AndroidManifest.xml

    <receiver android:name="com.Myapplication.receiver.StatusReceiver" android:exported="false">
        <intent-filter>
            <action android:name="com.Myapplication.receiver.UPDATE_STATUS" />
        </intent-filter>
    </receiver>
    <service
        android:name="com.Myapplication.util.VoiceCommandService"
        android:exported="false">
    </service>
    <meta-data android:name="com.parse.push.gcm_sender_id" android:value="id:XXXXXXXX" />'

这是我的Application.Java

    Parse.addParseNetworkInterceptor(new ParseLogInterceptor());
        Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
                        .applicationId(APPLICATION_ID)
                        .server(BRConstants.MY_IP_ADDRESS_SERVER).build()
        );

其他一切正常。但是推送似乎不起作用。没有错误,什么都没有。当我从 Android 发送数据时,我在控制台中收到此消息,该消息有请求但没有响应:

    GCM request and response {"request":{"params":
    {"priority":"normal","data":{"time":"2016-07-
    18T19:50:01.949Z","push_id":"2SxLKSeThF","data":"{\"header\":\"Status :
     Cancelled\",\"alertMessage\":\".....
    MYDATA.......\":\"Cancelled\"}"}}}}

不确定我在这里缺少什么。

【问题讨论】:

    标签: android parse-platform push-notification android-notifications parse-server


    【解决方案1】:

    您从 GCM 获得 2 个密钥。

    一个用于 Android 设备,另一个用于服务器。在解析中,您需要放置服务器密钥。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-21
      • 1970-01-01
      相关资源
      最近更新 更多