zoho / SalesIQ-Mobilisten-ReactNative

Your mobile app's ideal live chat partner. Power up your mobile App with the SalesIQ Mobilisten SDK for React-Native.
https://mobilisten.io/
9 stars 11 forks source link

Android notification not pushing when the app on the background. #50

Closed dieptang closed 1 year ago

dieptang commented 1 year ago

Hi,

Few month ago I config and setup everything for SaleIQ and it's working. Recently I saw the notification for android device no longer popup when I closed the app totally. It;s only working when I open my App and leave it. (IOS still works fine).

My notification from mainly function still works fine when I closed the app on the background. Only saleIQ is not.

I double checked all settings from url: https://www.zoho.com/salesiq/help/developer-guides/android-mobile-sdk-installation-2.0.html and I don't see any facing problem of that.

Screen Shot 2022-08-25 at 17 36 08

Any hints that I can make it working again?

bhahirathan-mb-11956 commented 1 year ago

Hi @dieptang ,

Thanks for reaching out to us. We're glad to know your interest in Mobilisten react-native. Please ensure you have completed the following steps,

  1. Add your project in firebase with all the given steps - documentation
  2. Add FCM to your project - documentation
  3. Finally, ensure mobilisten push messages are handled properly as given sample snippet below:

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.zohosalesiq.reactlibrary.RNZohoSalesIQ;

import java.util.Map;

public class MyFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage)
    {
        Map extras = remoteMessage.getData();

        //       Please pass the application context for the first param
        RNZohoSalesIQ.handleNotification(MainApplication.getApplication(), extras);
    }

    @Override
    public void onNewToken(String token) {    
        RNZohoSalesIQ.enablePush(token,true);
        //Pass true to test push notification from SalesIQ console

    }
}

Note: The google-services.json file and FCM server key must be taken from the same firebase project.

I hope this helps. Feel free to write us at (support@zohosalesiq.com) along with your Github ID for further assistance.

Regards, Bhahirathan.

dieptang commented 1 year ago

Yes, All is set already with that. I also found the test device:

image

But when I send the message use this test box, nothing happening. Strange that, when I send message using firebase cloud message, I see it's handle correctly, and notification is show.

image

image

When I sent from SaleIQ, onMessageReceived function was not triggered.

Actually, my app is productive already and has about 1000 customers. My standalone notification itself still works fine. Do you send the notification with "priority": "high" from json for example:

{
  "data":{
    "id": 1,
    "missedRequests": 5
    "addAnyDataHere": 123
  },
  "to": "fhiT7evmZk8:APA91bFJq7Tkly4BtLRXdYvqHno2vHCRkzpJT8QZy0TlIGs......",
  "priority": "high"
}
bhahirathan-mb-11956 commented 1 year ago

Hi @dieptang,

Please try to send some messages from your SalesIQ dashboard by initiating a test chat. If you still didn't receive any notifications for those messages then we're sorry for the inconvenience. We need to debug further on your push notification setup/configuration with the project to find the issue.

Could you please contact our support team at support@zohosalesiq.com, along with your GitHub ID, for further assistance?

Regards, Bhahirathan M.

dieptang commented 1 year ago

Yes, I sent from SalesIQ dashboard already, nothing happing. Please try to debug on yourself.

bhahirathan-mb-11956 commented 1 year ago

Hi @dieptang,

Sorry for the inconvenience. We have checked the push notifications from our side, and it's working correctly. We need to debug from our side with your project to identify the cause of the issue.

So please contact our support team at [support@zohosalesiq.com] with your portal name, and chat details used for push notification testing like chat IDs(starting with #). We will be happy to assist you.

Regards, Bhahirathan M.

dieptang commented 1 year ago

Hi @dieptang,

Sorry for the inconvenience. We have checked the push notifications from our side, and it's working correctly. We need to debug from our side with your project to identify the cause of the issue.

So please contact our support team at [support@zohosalesiq.com] with your portal name, and chat details used for push notification testing like chat IDs(starting with #). We will be happy to assist you.

Regards, Bhahirathan M.

Can you send me the video? Please make sure on android, your application closed on the background, and send the chat.

bhahirathan-mb-11956 commented 1 year ago

Hi @dieptang,

Please find the screen recording attachment link of the sample push notification working in both background and killed state.

link: https://workdrive.zohoexternal.com/file/8moeva8c22a87811847daa327c8d8c7c2611e

Regards, Bhahirathan M.

dieptang commented 1 year ago

Hi @DavidBhahirathan

Thank you so much, I recheck again line by line and found problem from ourside with the getApplicationContext() function was return null.

The problem is solved!