Hi, i’m testing push notification and in Android it’s working, But iOS is not receiving notification. I implemented the example of the Fuse documentation in link FuseJS/Push Module (JS).
I’ve set up the following scenario:
1º - Backend server in node.js
var fetch = require('node-fetch');
var API_ACCESS_KEY = 'AIzaSyD2nLYa2M.........U6EeIuecpU';
var DEVICE_ID1 = "APA91bHPRRcMA4e_rl-.........WYhFYdwci"; //Android
var DEVICE_ID2 = "7568137cccabf20502ff2.........c8b4c7b285"; //iOS
var msg = {
method: 'POST',
headers: {
'Authorization': 'key=' + API_ACCESS_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
registration_ids: [ DEVICE_ID1, DEVICE_ID2],
data: {
notification: {
alert: {
title: 'Well would ya look at that!',
body: 'Hello from some other app'
}
},
payload: JSON.stringify({key1: 'value1', key2: 'value2'})
}
})
};
fetch('https://fcm.googleapis.com/fcm/send', msg).then(function(response) {
console.log(response);
}, function(error) {
console.error(error);
});
2º - Fuse app
In the unoproj I added “Fuse.PushNotifications” in Packages and
"Android": {
"Package": "com.apps.pushmonteiro",
"GooglePlay": {
"SenderID": "7010.....0844"
}
},
"iOS": {
"BundleIdentifier": "com.apps.pushmonteiro",
"DevelopmentTeam": "5MW....4JY"
}
In the MainView.ux
<App>
<iOS.StatusBarConfig Style="Dark"/>
<Android.StatusBarConfig Color="#c2cac4"/>
<ClientPanel>
<ScrollView>
<StackPanel ItemSpacing="8">
<Each Items="{list}">
<Text Value="{}" TextWrapping="Wrap"/>
</Each>
</StackPanel>
</ScrollView>
<JavaScript>
var Observable = require('FuseJS/Observable');
var list = Observable();
var push = require("FuseJS/Push");
push.on("registrationSucceeded", function(regID){
list.add("Reg Succeeded: " + regID);
});
push.on("error", function(reason) {
list.add("Reg Failed: " + reason);
});
push.on("receivedMessage", function(payload) {
list.add("Recieved Push Notification: " + payload);
});
module.exports = {
list:list
}
</JavaScript>
</ClientPanel>
</App>
In the registrationSucceeded function you are able to register for both platforms. While running the service node.js is receiving notification on Android, but is not receiving on iOS.
Permissions are enabled, connection with wi-fi is good. When sending a notification through the Firebase Console for iOS also is not working.
Version
Operational system: macOS Sierra version 10.12.5
Fuse version 0.37.0 (build 12978)
Copyright (C) 2017 Fusetools
Another detail, when generating the app, need to open the project in Xcode and mark the configuration to allow “Push Notifications”, otherwise it is not registering. I wish I did not control it manually. If possible, please make it work.
Thanks in advance.