cybex-dev / twilio_voice

Flutter Twilio Voice Plugin
https://twilio-voice-web.web.app/
MIT License
40 stars 86 forks source link

notification showing incorrect identifier. #64

Closed victor-padovam closed 2 years ago

victor-padovam commented 2 years ago

Good afternoon,

I'm having a problem with the notification is getting the Identifier called: 'Victor' however it is incorrect it should be 'Alice', as my notification log is getting the twi_to=client:Victor and the correct would be twi_from=client:Alice

alt text

alt text

victor-padovam commented 2 years ago

For those who have the same problem I just solved. What did I do: Access the file IncomingCallNotificationService https://github.com/diegogarciar/twilio_voice/blob/master/android/src/main/java/com/twilio/twilio_voice/IncomingCallNotificationService.java#L88

You will change the role createNotification In return buildNotification(getApplicationName(context), getString(R.string.new_call, caller), To return buildNotification(getApplicationName(context), getString(R.string.new_call, fromId), what changes is the caller variable for fromId.

getting this way:

 String fromId = callInvite.getFrom().replace("client:", "");
 String caller = preferences.getString(fromId, preferences.getString("defaultCaller", "Unknown caller"));

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            Log.i(TAG, "building notification for new phones");
            return buildNotification(getApplicationName(context), getString(R.string.new_call, fromId),
                    pendingIntent,
                    extras,
                    callInvite,
                    notificationId,
                    createChannel(channelImportance));
        }

alt text