Ich knalle meinen Kopf gegen die Wand, weil ich nicht finden kann, warum meine Push-Benachrichtigungen nicht funktionieren.Ionic V1: Fehler 404 beim Speichern von Push-Benachrichtigungs-Token
Eine kleine Versionsliste:
$ cordova plugin info
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-splashscreen 4.0.1 "Splashscreen"
cordova-plugin-statusbar 2.2.1 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.8.4 "PushPlugin"
$ ionic info
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v5.12.0
Xcode version: Not installed
Hier ist der Code, der für das Push-System registriert:
// In config
$ionicCloudProvider.init({
core: {
app_id: "xxxx"
},
push: {
sender_id: "yyyyyy",
pluginConfig: {
ios: {
badge: true,
},
android: {
iconColor: "#343434"
}
}
}
});
// In controller
// Register Push notifications
$ionicPush.register().then(function (t) {
console.log('register successfull', t);
return $ionicPush.saveToken(t, {
ignore_user: true
});
}).then(function (t) {
console.log('Token saved:', t);
alert('Token saved:', t.token);
});
Ich bin Debuggen mit USB-Android-Handy, mit:
ionic run android
Dann inspiziere ich mit dem Chrome Device Inspector, um zu sehen, was passiert. Das Ding ist, erscheint das Verzeichnis erfolgreich ", mit einer„richtigen“Token
{
"token": "fWjLt4mOttw:APA91bE4KCycHlu92T6fJTzMFbRFtJdTUrb2u9jv5LTO2yTPD_-sKshbqo93UStwjdJpmLun2tJBCgegaUYnlj9kxxFWFPi9hobZH5W80OnrsPdfxrdYNmp8SYM_SXp-5RiknFrbPl5l",
"app_id": "XXXXXX"
}
Aber der saveToken Methode schlägt mit einem 404-Fehlern. Als ich die Anfrage mit curl in meiner Schale (Rechtsklick> Kopieren> als curl) wiedergeben, ich keine Fehler haben ... Hier ist die Log-Chromkonsole:
POST https://api.ionic.io/push/tokens 404 (Not Found)
Ionic Push: Error: Not Found
at q.<anonymous> (app.js:formatted:717)
at q.t.emit (app.js:formatted:9164)
at XMLHttpRequest.n.onreadystatechange (app.js:formatted:9424)
Hier ist die Ausgabe von Curl (scheint richtig)
{
"meta": {
"status": 201,
"version": "2.0.0-beta.0",
"request_id": "92487e15-9f2a-416f-c15b-9129e9e10049"
},
"data": {
"token": "fWjLt4mOttw:APA91bE4KCycHlu92T6fJTzMFbRFtJdTUrb2u9jv5LTO2yTPD_-sKshbqo93UStwjdJpmLun2tJBCgegaUYnlj9kxxFWFPi9hobZH5W80OnrsPdfxrdYNmp8SYM_SXp-5RiknFrbPl5l",
"type": "android",
"invalidated": null,
"valid": true,
"created": "2017-03-07T16:43:58.993190+00:00",
"app_id": "f2de99a1",
"id": "c85e1bdbb6b3cf2da8f090ba59df6892"
}
}
Könnte mir jemand helfen? Danke!