QuickBlox / q-municate-ios

Q-municate iOS repository
http://q-municate.com
MIT License
163 stars 86 forks source link

VOIP Push not working for Android to iOS when app is not running #339

Closed kushal211 closed 6 years ago

kushal211 commented 6 years ago

Hi,

I'm facing one issue with a specific case where I'm calling to iOS user from Android device and application is in the background in iOS, the push notification is not coming to the iOS device and it is also not showing in Admin panel "Queue" section.

All the other cases are working fine. I'm using Q-municate-android for the Android application.

Please help me with this specific case.

Note: I've tried sending VOIP push from the dashboard and it is working fine.

Thank you.

ghost commented 6 years ago

@kushal211, Hello. Could you please enable full logs and send us this information?

[QBSettings setLogLevel:QBLogLevelDebug];
[QBSettings enableXMPPLogging];
kushal211 commented 6 years ago

Hi,

Yes I've log enabled and there are many logs generated in console. It is all working fine and perfect for iOS to iOS, iOS to Android. Just in case of Android to iOS.

Should I send you the logs from iOS ?

ghost commented 6 years ago

@kushal211, Could you please check that event's payload from android contains: "VOIPCall" : "1"?

ghost commented 6 years ago

@kushal211, Could you please print event(all keys and values) that you are sending from android? You're sending universal push, aren't u?(event.pushType parameter is omitted)

kushal211 commented 6 years ago

hi @VitaliyGuru ,

Yes, I've checked that thing and it was missing in Android app. So I've added that in the payload.

Here is the complete payload from the Android app:

{
    message_type=push_type_call,
    VOIPCall=1,
    friends=[
      49554268
    ],
    message=leesaiscallingyou!,
    ios_voip=1
 }

Please note that I've added one extra key as well ios_voip and also tried with all the possible combination of the keys by removing them one by one but none of them got me success.

It is not even adding the push notification in the Queue of the push notification in my dashbaord.

ghost commented 6 years ago

@kushal211, Please provide code for creating the event with VOIPCall=1 in Android

kushal211 commented 6 years ago

Hi @VitaliyGuru ,

Here is the code I'm using in Android:

Public class CoreNotificationHelper {

    public static QBEvent createPushEvent(List<Integer> userIdsList, String message, String messageType) {
        StringifyArrayList<Integer> userIds = new StringifyArrayList<Integer>();
        userIds.addAll(userIdsList);
        QBEvent event = new QBEvent();
        event.setUserIds(userIds);
        event.setEnvironment(QBEnvironment.DEVELOPMENT);
        event.setNotificationType(QBNotificationType.PUSH);
        event.setPushType(QBPushType.GCM);

        // Custom - For iOS VOIP Push
        event.setPushType(QBPushType.APNS_VOIP);

        setMessage(event, message, messageType);
        return event;
    }

    private static void setMessage(QBEvent event, String message, String messageType) {
        if (!setMessageWithTypeIfNeed(event, message, messageType)) {
            event.setMessage(message);
        }
    }

    private static boolean setMessageWithTypeIfNeed(QBEvent event, String message, String messageType) {
        if (!TextUtils.isEmpty(messageType)) {
            HashMap<String, Object> data = new HashMap<>();
            data.put("data.message", message);
            data.put("data.type", messageType);

            // Custom - For iOS VOIP Push
            data.put("data.message","1" );
            data.put("data.type", "ios_voip");

            data.put("data.message","1" );
            data.put("data.type", "VOIPCall");

            event.setMessage(data);
            return true;
        }
        return false;
    }

}

Note: You can check the code which is commented as Custom - For iOS VOIP Push which I've added in CoreNotificationHelper class

kushal211 commented 6 years ago

Hi @VitaliyGuru ,

Any update on the code provided?

ghost commented 6 years ago

@kushal211, Please use the code from the Android Q-municate. And in the method createPushEvent you should provide PUSH_MESSAGE_TYPE_CALL for messageType parameter and set the appropriate environment.


You shouldn't call setPushType method in order to send universal push notifications(cross-platform).

ghost commented 6 years ago

@kushal211, Any updates?

kushal211 commented 6 years ago

Hi @VitaliyGuru ,

Yes, I've replaced the code as you mentioned and now it is working. Thank you so much for the help. :) 👍

The only problem sometimes I face is that it takes too long to receive a call notification.

leena12345 commented 6 years ago

Hi @VitaliyGuru ,

In android, sometimes, Chat history screen contains duplicate data in listview .. (Class :DialogsListFragment ) Thanks

Raikerian commented 6 years ago

Hi @leena12345

This is an iOS-only repository and we have nothing to do with android code. Please report all android issues to Quickblox Android repository here: https://github.com/QuickBlox/quickblox-android-sdk/issues