ben-xD / push

Push notifications in Flutter without firebase_messaging.
https://pub.dev/packages/push
38 stars 25 forks source link

iOS is not receiving the push notifications with apns-push-type = background #70

Open mhb675 opened 1 month ago

mhb675 commented 1 month ago

iOS is not receiving the push notifications with apns-push-type = background, it only receives push notifications with the apns-push-type = alert.

Type alert payload

{
    "aps": {
        "alert": {
            "title": "Missed Call",
            "body": "John Doe"
        }
    }
}

Type background payload

{
    "aps": {
        "content-available": 1
    },
    "data": {
        "incomingCall": {
            "caller": {
                "name": "John Doe",
                "number": "1234"
            }
        }
    }
}
GICMan commented 1 month ago

Seconding this! @ben-xD is this package still being maintained? It looks like there hasn't been activity for 6 months.

bryantwilliam commented 1 month ago

Me too.

Also, foreground messages aren't received on iOS (but are on Android) Also, the terminated -> notification -> tap data shows on iOS, but on Android it's flakey (doesn't show 100% of the time). Also, the terminated -> notification is delayed by like 20 seconds on Android, whereas iOS is almost instant.

Related open issues:

@ben-xD bump 🙏

xbrny commented 6 days ago

@bryantwilliam , I managed to resolve the foreground notification issue on iOS by removing the flutter_local_notifications setup code from AppDelegate.m or AppDelegate.swift (reference: flutter_local_notifications setup).

And for the Android delay issue, it's due to the point mentioned in the README.md:

Warning: In the specific case where your Android app is in the terminated state and a push notification is received, any side effects caused by your handlers must complete before the completing the handler. This is because the Flutter application may be terminated as soon as the Future of the handler completes.

bryantwilliam commented 6 days ago

Hey @xbrny, thanks for the reply. Great work with that iOS foreground fix. Regarding the Android delay issues, my handlers only have basic print statements, so no side effects.

bbjay commented 1 day ago

Did someone try a background push with a badge count set? like:

"aps": {
        "badge": 1,
        "content-available": 1
    },

This way you could see if the message is received by the device/simulator, when the badge count on the app icon changes. If it does, it is probably an issue with configuring the right delegate methods. If it doesn't, the background push isn't delivered and the issue does not lie on library side.