Push Notification Scheduled but not Received

I’m building an Android app, and I’ve implemented Push Notification.
However I’m getting ‘SCHEDULED’ status message when sending a Push Notification, but I haven’t been able to actually receive it on my Android device. Any reasons for that?

Here’s the code:

                    Backendless.Messaging.publish(
                        "Palette Approved!",
                        PublishOptions(),
                        DeliveryOptions(),
                        object : AsyncCallback<MessageStatus> {
                            override fun handleResponse(response: MessageStatus?) {
                                Log.d("HomeViewModel", "${response?.status}")
                            }

                            override fun handleFault(fault: BackendlessFault?) {
                                Log.d("HomeViewModel", "${fault?.message}")
                            }
                        }
                    )

Hello @Stefan_Jovanovic

I guess the problem is not finished setup of push notifications in your app.

You could send a test push through Push Templates.

Also, when you sent message you can check status with received id - link

Regards, Dima

It says it was published, but I wasn’t able to see the notification in my app.

Hello @Stefan_Jovanovic

I’ve created an internal ticket BKNDLSS-28249 to investigate this issue

Regards,
Viktor

1 Like

Hi @Stefan_Jovanovic ,

Could you please provide your App ID?

Regards, Andriy

Here it is: 195055C2-93D4-F6AB-FF9C-142C8A8E2500

@Stefan_Jovanovic ,

Thanks. I have couple more questions:

  1. Did you fully follow this instruction Push Notification Setup (Android) - Backendless SDK for Android/Java API Documentation?
  2. Could you please check if push notifications are not forbidden for your app on your target device?
  3. Have you tried to send push notification using “Send now” button from template page in Console?
  4. Could you please try to send push notification to your device directly from Firebase?

Regards, Andriy

  1. Yes I’ve followed that documentation completely.
  2. Notifications are allowed for my app.
  3. I’ve tried and it was not working.
  4. I’ve used that deviceToken from backendless to specify FCM registration token on Firebase console in order to send the notification, however that was not working either.

Also I’ve noticed that in your documentation you’ve written that we need only two dependencies for Push Notifications:

    implementation 'com.google.firebase:firebase-core:20.1.2'
    implementation 'com.google.firebase:firebase-messaging:23.0.3'

However we actually need one more:

    implementation 'com.google.firebase:firebase-iid:21.1.0'
    implementation 'com.google.firebase:firebase-core:20.1.2'
    implementation 'com.google.firebase:firebase-messaging:23.0.3'

Because if I don’t add that new one, then I’m getting an exception:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;

Hi @Stefan_Jovanovic ,

I’ve used that deviceToken from backendless to specify FCM registration token on Firebase console in order to send the notification, however that was not working either.

This indicates that problem somewhere outside Backendless since your device didn’t receive notifications even directly from Firebase.
On this forum we help to troubleshot problems related to Backendless platform.
I would advice you to try to figure out why your device doesn’t receive push notifications from Firebase since root of problem lies there.

Regards, Andriy

1 Like

I’ve actually now tested Firebase Cloud Messaging, Test Push notification and I’m able to get it while my app is in the background. If I want to receive it in the foreground I would need to implement ‘FirebaseMessagingService’. However I’ve already declared your ‘BackendlessFCMService’ in my AndroidManifest file. So a backendless implementation should handle that instead. But I’m not able to receive the notification from backendless even if my app is in the background.

I’ve also successfully registered my device from MainActivity as well:

        val channels: MutableList<String> = ArrayList()
        channels.add("default")
        Backendless.Messaging.registerDevice(
            channels,
            object : AsyncCallback<DeviceRegistrationResult?> {
                override fun handleResponse(response: DeviceRegistrationResult?) {
                    Log.d("MainActivity", "${response?.deviceToken}")
                }

                override fun handleFault(fault: BackendlessFault) {
                    Log.d("MainActivity", fault.message)
                }
            })

And from my ViewModel, I’m using a Real Time database to trigger the Push Notification every time there’s an update in the table. I’m able to successfully print the MessageStatus whenever that happens. It says that notification was published/scheduled, but I’m not receiving it.

    private fun observeApprovedPalettes() {
        viewModelScope.launch(Dispatchers.IO) {
            repository.observeApprovedPalettes(ownerId = Backendless.UserService.CurrentUser().objectId)
                .collectLatest { palette ->
                    Backendless.Messaging.publish(
                        "Palette Approved!",
                        PublishOptions(),
                        DeliveryOptions(),
                        object : AsyncCallback<MessageStatus> {
                            override fun handleResponse(response: MessageStatus?) {
                                Log.d("HomeViewModel", "${response?.status}")
                                Log.d("HomeViewModel", "${response?.messageId}")
                            }

                            override fun handleFault(fault: BackendlessFault?) {
                                Log.d("HomeViewModel", "${fault?.message}")
                            }
                        }
                    )
                }
        }
    }

Also I’ve checked the notification option for my app. And notifications are enabled. However an option called ‘Pop on screen’ wasn’t enabled by default, which I’ve changed. But even after that I’m still unable to receive the push notification.


Hello @Stefan_Jovanovic

please check the message status after you have sent it Get Message Status - Backendless SDK for Android/Java API Documentation , if the message status is PENDING then check again

The status that I received is: PUBLISHED
I was able to get a test notification from Firebase while my app was in the background. However I wasn’t able to receive a notification from backendless either from background or foreground.

I’m triggering a push notification when I manually change one element in my database table, and that works perfectly fine, however I don’t see a notification on my device.

    private fun observeApprovedPalettes() {
        viewModelScope.launch(Dispatchers.IO) {
            repository.observeApprovedPalettes(ownerId = Backendless.UserService.CurrentUser().objectId)
                .collectLatest { palette ->
                    Backendless.Messaging.publish(
                        "Palette Approved!",
                        PublishOptions(),
                        DeliveryOptions(),
                        object : AsyncCallback<MessageStatus> {
                            override fun handleResponse(response: MessageStatus?) {
                                Log.d("HomeViewModel", "${response?.status}")
                                Log.d("HomeViewModel", "${response?.messageId}")
                            }

                            override fun handleFault(fault: BackendlessFault?) {
                                Log.d("HomeViewModel", "${fault?.message}")
                            }
                        }
                    )
                }
        }
    }

@Stefan_Jovanovic please share your google-services.json file, I’ll try to reproduce the issue with your app

Here you go. Thanks Sergey! :slight_smile:
google-services.zip (676 Bytes)

Hello @Stefan_Jovanovic

Thank you for the information. I created an app based on your google-services.json and registered my device in your app. Then I sent a push notification from Backendless Console and received it. Here is my project.
Support Push.zip (903.5 KB)

Regards,
Inna

Hi Inna, I’ve downloaded and tested your project, it works! I’ve sent a push notification from my backendless dashboard.

However with my app, I’m still facing the issue, and I do not have a clue what’s going on, because I did everything the same. I’m registering device in my activity’s onCreate method. But still not receiving it. It’s been 2 weeks and it really start’s to go on my nerves.

Can I send you my project, so that you can just change the app/api key with your own and start the app? Because in my MainActivity I’m doing all the work for initializing the backendless and registering the app.