stream-chat-android icon indicating copy to clipboard operation
stream-chat-android copied to clipboard

Push notifications not received with get stream android sdk v2

Open jigar-android-inc opened this issue 2 years ago • 10 comments

I have followed all steps listed here - https://getstream.io/chat/docs/sdk/android/client/guides/push-notifications/firebase/ to implement push notifications with get stream and firebase. Have added private key generated from firebase to get stream dashboard and did configuration in my android code. I was able to implement notifications with get stream v1 successfully in no time, but having hard time achieving the same with v2. Any help would be greatly appreciated!

jigar-android-inc avatar Aug 08 '22 14:08 jigar-android-inc

Hey @jigar-android-inc !

One of the most common issues with Push v2 is that if you have a custom notification template in Firebase, PNs don't work correctly.

Could you please Follow the guidelines in here: https://getstream.io/chat/docs/android/upgrading_to_push_v2/?language=kotlin

Where we talk about upgrading to v2 and working around the template issue?

Thanks!

filbabic avatar Aug 10 '22 07:08 filbabic

Thanks @filbabic for guiding! I have followed the migration guide and didn't set any template for Notification. In that case as per the documentation, default template should be used ?

I can't see any push logs. I checked registered devices for a user to confirm there is at-least one registered device. Also tried disconnecting the socket for another user to get PNs. Despite all steps configured I correctly, I have no luck getting PNs.

jigar-android-inc avatar Aug 10 '22 08:08 jigar-android-inc

Hey @jigar-android-inc !

Could you send us your app ID and user ID that you're sending PNs, through our support channels, so that we can include the BE team in the discussion? :]

I think it'll surely help us resolve the issues!

filbabic avatar Aug 11 '22 07:08 filbabic

Hey @filbabic .I already contact your support channel twice but didn't got any response from them. My app ID is 1194792 and user ID for which I'm testing PNs is 62f0ecfce2337ec25db33c6e and 6294a74b7ed49740e258b4d4.

jigar-android-inc avatar Aug 12 '22 07:08 jigar-android-inc

Hey @jigar-android-inc I'm sad to hear that - but I imagine that if people had seen the support request, we'd have received an android ticket and could work it out there too.

I'll forward this info to the BE team and I'll see if we can work it out! :]

filbabic avatar Aug 12 '22 07:08 filbabic

Hello @jigar-android-inc ,

Sorry for this inconvenience. We have checked in BE and it seems that you have a multi-bundle push provider enabled which has a name, but you don't provide the push provider name when adding devices. This will lead to attaching devices to nameless, disabled push provider.

When adding a device please also provide providerName field in the Device:

client.addDevice(
    Device(
        token = "push-provider-token",
        pushProvider = PushProvider.FIREBASE,
        providerName = "my_provider_name",
    )
).enqueue { result ->
    if (result.isSuccess) {
        // Device was successfully registered
    } else {
        // Handle result.error()
    }
}

From our side we will update our documentation to mention this for Kotlin, as providerName option was missing there.

ffenix113 avatar Aug 12 '22 08:08 ffenix113

Hey @ffenix113 okay, I'll try adding provider name with a new device and user. Also can you tell me how to disable multi-bundle push provide as it was enabled by default ?

jigar-android-inc avatar Aug 12 '22 09:08 jigar-android-inc

Multi-bundle is the feature of Push V2, and it can't be disabled. However you can stop using named push provider(preferably by disabling and/or removing it) and enable back nameless configuration. In this case it will be possible to add devices without specifying push provider name.

ffenix113 avatar Aug 12 '22 11:08 ffenix113

@ffenix113 Even if I add device with the provider-name, when I retrieve list of devices I get devices with provider name null. 'new_message' is firebase provide name on my account.

addDevice(Device(
                                token = preference.getDeviceToken()?:"",
                                pushProvider = PushProvider.FIREBASE,
                                providerName = "new_message"

                            ))

jigar-android-inc avatar Aug 12 '22 11:08 jigar-android-inc

Oh @jigar-android-inc this makes more sense - thank you @ffenix113 for the help.

We've merged this PR: https://github.com/GetStream/stream-chat-android/pull/4008/files which should resolve your issue and it'll be release in the next SDK version (most likely early next week).

Once that's out, you should be able to support this fully!

Sorry if there was any confusion around this, I just had realized these two things are connected!

filbabic avatar Aug 12 '22 14:08 filbabic

hey @jigar-android-inc, I'm going to close this issue as the fix has been shipped in the 5.8.0 release. Let us know if you have any further questions.

adasiewiczr avatar Aug 17 '22 07:08 adasiewiczr