Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
109 stars 139 forks source link

iOS inApp push-notification event not firing #261

Closed rsirunesys closed 6 years ago

rsirunesys commented 6 years ago

Foreground (in app) notifications not coming through Issue present in 7.0.6 Issue not present in 7.0.5 and prior PhoneGap Build cli-6.5.0

wfhm commented 6 years ago

Hi,

Checking this.

wfhm commented 6 years ago

@rsirunesys

Could you please describe the issue in a bit more details? What do you mean by In App notifications? Did you mean In-app messages feature or were you talking about regular push notifications received in foreground state?

mhueserNDR commented 6 years ago

Im having the same problem since the last update for a regular push notification in foreground state

rsirunesys commented 6 years ago

Regular push notifications received in foreground state. Using this Javascript code a notification is available in the foreground state under 7.0.5 but it does not fire under 7.0.6.

document.addEventListener('push-notification', function(event) { //get the notification payload var notification = event.notification; alert('we got a message'); });

rsirunesys commented 6 years ago

Sorry... hit the wrong button and closed the issue. Re-opened now.

wfhm commented 6 years ago

@rsirunesys @mhueserNDR

With the latest release, we have reworked the logics of showing notification alerts/banners and handling pushes in foreground to make it more simple and clear. Now this behavior only depends on Pushwoosh_ALERT_TYPE flag in your info.plist. By default, this value is set to NONE (push is handled automatically when received, banner/ alert is not shown).

Therefore, if you want to show an alert or a banner when receiving push in foreground state, you should set an ALERT or a BANNER value for this flag. Use the following command:

cordova plugin add pushwoosh-cordova-plugin --variable IOS_FOREGROUND_ALERT_TYPE="ALERT"

Please refer to the docs below for additional details: http://docs.pushwoosh.com/docs/customizing-cordova-plugin#push-notifications-in-foreground

wfhm commented 6 years ago

@rsirunesys @mhueserNDR

Turned out it is indeed an unexpected behavior, the issue is reopened. A fix will be rolled out shorty.

kirajhpang commented 6 years ago

Hi I was using this as config.xml

 <plugin name="pushwoosh-cordova-plugin" spec="^7.0.5">
        <variable name="IOS_FOREGROUND_ALERT_TYPE" value="BANNER" />
        <variable name="ANDROID_FOREGROUND_PUSH" value="true" />
        <variable name="LOG_LEVEL" value="DEBUG" />
    </plugin>

But iOS doesn't show as BANNER when notification receive in foreground, it need use following listener to show as BANNER

document.addEventListener('push-notification', function (event: any) {
      //get the notification payload
      var notification = event.notification;

      //display alert to the user for example
      alert(notification.aps.alert);

      //clear the app badge
      pushNotification.setApplicationIconBadgeNumber(0);
    });

if this case, it is no able to handle action on click the notification. Anyway to solve this issue in iOS?

jQrgen commented 6 years ago

I have kind of the same issue with version 7.0.6

the push-notification event fires when app is in background or closed, but not when in foreground.

rsirunesys commented 6 years ago

Use 7.0.5 - it's ok for foreground.

jQrgen commented 6 years ago

Thanks, @rsirunesys 7.0.5 works.

Also for you guys at pushwoosh I would be very thankful if you implemented a QA checklist for basic functionality before publishing new versions of this plugin.

kirajhpang commented 6 years ago

@rsirunesys @jQrgen Does 7.0.5 still need use following code for display banner? I currently stuck in onClick Notification handler, I believe this listen on this event, but If I change code behaviour on here, it doesn't show Banner at all.

document.addEventListener('push-notification', function (event: any) {
      //get the notification payload
      var notification = event.notification;

      //display alert to the user for example
      alert(notification.aps.alert);

      //clear the app badge
      pushNotification.setApplicationIconBadgeNumber(0);
    });
wfhm commented 6 years ago

Fixed in 7.0.7

kirajhpang commented 6 years ago

@wfhm will get it a try..!! thanks the update

rsirunesys commented 6 years ago

7.0.7 posted 5 days ago... no update here... would have been nice to know it was released.

7.0.7 under PhoneGap Build 6.5.0 fails to build. 7.0.5 has a successful build. 7.0.7 under PhoneGap Build 7.0.1 also fails to build. Same error.

Can this issue be re-opened... or is it a different issue? The PGB Log is attached.

PGB_650_PW707.txt

wfhm commented 6 years ago

@rsirunesys I strongly apologize for not updating you timely!

As for iOS build failing with Phonegap Build with the latest version of Pushwoosh plugin, it is a known issue. 7.0.7 release includes support of iOS 11, which requires XCode 9. Adobe have not yet updated cordova-ios for PGB, thus it is failing. It works fine when building locally with the latest XCode though.

You can use earlier versions of pushwoosh-cordova-plugin (not higher than 7.0.4) for iOS with Phonegap Build until Adobe includes support of the latest XCode.

rsirunesys commented 6 years ago

Thanks @wfhm ... appreciated.

Why not higher than 7.0.4? Just curious. 7.0.5 builds ok... and works ok.

wfhm commented 6 years ago

@rsirunesys

7.0.4 does not differ from 7.0.5 from iOS perspective, however if you maintain both platforms, changes made for Android in 7.0.5 were rolled back in 7.0.6, so 7.0.4 is preferable in general.

rsirunesys commented 6 years ago

Understood... perfect... thank you... 7.0.4 it is.

kirajhpang commented 6 years ago

@wfhm thanks for the update, 7.0.7 is working very well.

But as remind, if your android project consist other gms service like

// in ionic Project.Properties
cordova.system.library.3=com.google.android.gms:play-services-auth:11.+
cordova.system.library.4=com.google.android.gms:play-services-identity:11.+

you need change version to 11.2.0 consistent with v7.0.7 plugin.xml gms setting, to avoid crashing.

// in ionic Project.Properties
cordova.system.library.3=com.google.android.gms:play-services-auth:11.2.0
cordova.system.library.4=com.google.android.gms:play-services-identity:11.2.0