Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phone Gap Plugin push notification configurationnot working #36

Open
koteshgit opened this issue Feb 21, 2019 · 8 comments
Open

Phone Gap Plugin push notification configurationnot working #36

koteshgit opened this issue Feb 21, 2019 · 8 comments

Comments

@koteshgit
Copy link

No description provided.

@koteshgit
Copy link
Author

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

@koteshgit
Copy link
Author

pushmessage

@koteshgit
Copy link
Author

Please help me to configure the push notification configuration for ionic3 mobile app
Kotesh
7032675401

@techaffinity
Copy link
Owner

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);
});

}

@Swatantramishra1
Copy link

image

Hi While adding a plugin, its creating gradle issue.

@Swatantramishra1
Copy link

Will it work without adding cordova plugin add https://github.com/techaffinity/phonegap-plugin-push.git --variable SENDER_ID=20738924380 ?

@Swatantramishra1
Copy link

@techaffinity any update ?

@techaffinity
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants