Open koteshgit opened 5 years ago
Please help me to configure the push notification configuration for ionic3 mobile app Kotesh 7032675401
Please try one of the below steps to see if it fixes the issue
Step 1: Remove Cordova plugin using the following command cordova plugin rm cordova-plugin-freshchat Then remove android platform. cordova platform rm android. Now add cordova plugin. cordova plugin add https://github.com/techaffinity/freshchat-phonegap.git Then add android platform. cordova platform add android
Step 2: The working code is given below, please refer for clarifications
initialPluginPush() {
let push = (window as any).PushNotification.init({
android: {
senderID: "" //You add firebase senderId
},
ios: {
alert: "true",
badge: true,
sound: 'false'
},
windows: {}
});
push.on('registration', (data) => {
console.log(data.registrationId);
(window as any).Freshchat.updatePushNotificationToken(data.registrationId);
});
push.on('notification', (data) => {
(window as any).Freshchat.isFreshchatPushNotification(data, function (isFreshchatNotif) {
console.log(isFreshchatNotif);
if (isFreshchatNotif) {
console.log("entered inside Freshchat for handle");
(window as any).Freshchat.handlePushNotification(data);
} else {
console.log("entered else for handle");
alert(data);
}
});
});
push.on('error', (e) => {
console.log(e.message);
});
}
Hi While adding a plugin, its creating gradle issue.
Will it work without adding cordova plugin add https://github.com/techaffinity/phonegap-plugin-push.git --variable SENDER_ID=20738924380
?
@techaffinity any update ?
Hi Did you try adding the below plugin as mentioned in the docs https://github.com/dpa99c/cordova-android-support-gradle-release
Can you try and share us the response?
Hi, I tried to set up push notifications by providing the Serial ID. But it is not working. I need some assistance to setup the push notifications for phonegap fc plugin.
Please arrange small call so that It will be useful for us.
Thanks & Regards Kotesh 7032675401