richsage / RMSPushNotificationsBundle

NOT MAINTAINED! ⛔️ Push notifications/messages for mobile devices. Supports iOS, Android (C2DM, GCM), Blackberry and Windows Mobile (toast only). A Symfony2 bundle.
MIT License
321 stars 152 forks source link

Issues with objects in Android Notifications #175

Open Minirock opened 5 years ago

Minirock commented 5 years ago

I'm using the bundle in order to send notification to iOS and Android like that

        if ($notif->getDeviceOs() == 1) {
            $message_bad = new iOSMessage();
            $message_bad->setMessage($notif->getContent());
            $message_bad->setDeviceIdentifier($notif->getDeviceId());
            $message_bad->setData($notif->getData());
            $this->container->get('rms_push_notifications')->send($message_bad);
        } else {
            $message_better = new AndroidMessage();
            $message_better->setMessage($notif->getContent());
            $message_better->setDeviceIdentifier($notif->getDeviceId());
            $message_better->setGCM(true);
            $message_better->setData($notif->getData());
            $this->container->get('rms_push_notifications')->send($message_better);
        }

In both case this is working, I'm receiving the notification for iOS and Android.

Problem is about the data returned by Android.

2 issues

Number 1:

iOS; field data is returned with the content of $notif->getData() Android: field data isn't returned. I would like to be able to get data field.

Number 2: iOS : profile is an object Android: profile is a string with all the objects fields in the string.

I would like to get it as an object and not a string.

Thanks for your assistance.

EDIT: Also I wonder if this might not be related as Android Notification looks like to be using gcm in the bundle:

As of April 10, 2018, Google has deprecated GCM. The GCM server and client APIs are deprecated and will be removed as soon as April 11, 2019. Migrate GCM apps to Firebase Cloud Messaging (FCM), which inherits the reliable and scalable GCM infrastructure, plus many new features. See the migration guide to learn more.