【发布时间】: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