Giter VIP home page Giter VIP logo

Comments (13)

fabriziomoscon avatar fabriziomoscon commented on June 8, 2024 1

If you have setup you GCM correctly the VoiceBroadcastReceiver onReceive method is called: https://github.com/hoxfon/react-native-twilio-programmable-voice/blob/master/android/src/main/java/com/hoxfon/react/TwilioVoice/TwilioVoiceModule.java#L444-L451

that code block either sends a deviceNotReady JS event of sets the gcmToken
To make it work I followed all instruction to make Firebase working.
So basically FCM/GCM push notification must work on your setup to make this module working

from react-native-twilio-programmable-voice.

fabriziomoscon avatar fabriziomoscon commented on June 8, 2024 1

So it turns out the instructions in the README.md where wrong.

This commit fixes it
86b022d

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024

Also, and this is a general question, but is this package working for you as is? @fabriziomoscon thanks again for your time.

from react-native-twilio-programmable-voice.

fabriziomoscon avatar fabriziomoscon commented on June 8, 2024

Hi @dabit3 I have been using this package in my app for two/three months, there are few testers using it to make and receive calls, so far there were no complaints. The app will be soon publicly available.

I am actually not using TwilioVoice.requestPermission(GCM_sender_id) - most probably I should use it to request permissions dynamically as recommended since Android 6, but so far to initialise the library and register the token to make calls, I call initWithAccessToken(token) when the app is started and resumed.

In my app I am not using/setting a specific GCM_sender_id, the GCMRegistrationService uses the default one. Also I could not find a use in this example project: https://github.com/twilio/voice-quickstart-android, that is a good question we could post on that repo for Twilio's engineers to answer directly. Usually they are very helpful with this kind of questions.

Let me know if you have any other questions regard to this or another topic about the library

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024

Ah, thanks, very helpful.

I think I've narrowed my issue down to gcmToken being null. I do not see where this is being set in TwilioVoiceModule.java when the app is initialized @fabriziomoscon

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024
 public void initWithAccessToken(final String accessToken) {
        if (accessToken != "") {
            TwilioVoiceModule.this.accessToken = accessToken;
            if (gcmToken != null) {
                register();
            }
        }
    }

In this method, I am getting gcmToken as being null

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024

Ok I'll check this out and see that I have all configuration correct.

Thanks again for your time.

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024

Do we need to update the Manifest with Firebase configuration re: -> https://firebase.google.com/docs/cloud-messaging/android/client ?

from react-native-twilio-programmable-voice.

fabriziomoscon avatar fabriziomoscon commented on June 8, 2024

Interesting!
I have used in my app
com.google.android.gms:play-services-gcm:10.0.1
not
com.google.firebase:firebase-messaging:10.0.1

it is within my app's android/app/build.gradle:

dependencies {
    ...
    compile project(':react-native-fcm')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:+'  // From node_modules
    compile ('com.google.android.gms:play-services-gcm:10.0.1') {
        force = true;
    }
}
...
// Firebase integration
apply plugin: 'com.google.gms.google-services'

but I saw another project that includes the configuration within the module: https://github.com/tipsi/tipsi-stripe/blob/master/android/build.gradle#L22-L29

I am not sure what is the best way: include the Google service configuration in the app or in the library. I thought that keeping updated with the latest version of Google Play service was an app concern not a library one. Also I thought that users of the library might have already push notification integrated.

But this is not set in stones. If you know better what to do in this situation let me know.

  1. should the configuration be com.google.android.gms:play-services-gcm:10.0.1 or com.google.firebase:firebase-messaging:10.0.1
  2. should the configuration be inside the library or in the app?

Twilio Example app add the configuration in the app:
https://github.com/twilio/voice-quickstart-android/blob/master/app/build.gradle

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024

So for some reason it looks like the code at

TWILIODEVICELOG registerActionReceiver called is called, but

TWILIODEVICELOG now inside registerActionReceiver

is never called.

private void registerActionReceiver() {

        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(ACTION_ANSWER_CALL);
        intentFilter.addAction(ACTION_REJECT_CALL);
        intentFilter.addAction(ACTION_HANGUP_CALL);
        Log.d(LOG_TAG, "TWILIODEVICELOG registerActionReceiver called!");
        getReactApplicationContext().registerReceiver(new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                Log.d(LOG_TAG, "TWILIODEVICELOG now inside registerActionReceiver!");
                String action = intent.getAction();
                if (action.equals(ACTION_ANSWER_CALL)) {
                    accept();
                } else if (action.equals(ACTION_REJECT_CALL)) {
                    reject();
                } else if (action.equals(ACTION_HANGUP_CALL)) {
                    disconnect();
                }
                // Dismiss the notification when the user tap on the relative notification action
                // eventually the notification will be cleared anyway
                // but in this way there is no UI lag
                notificationManager.cancel(intent.getIntExtra(NOTIFICATION_ID, 0));
            }
        }, intentFilter);
    }

from react-native-twilio-programmable-voice.

fabriziomoscon avatar fabriziomoscon commented on June 8, 2024

That is the code block that handles the intent when the users taps on the notification that pops up when receiving a call. The intent is created here: https://github.com/hoxfon/react-native-twilio-programmable-voice/blob/master/android/src/main/java/com/hoxfon/react/TwilioVoice/NotificationHelper.java#L106-L175
That would be triggered when a call is received if the server+twilio are configured correctly.

Your configuration should also work with this app: https://github.com/twilio/voice-quickstart-android there is no change in the underline GCM token setup.

I use Android Studio debugger usually to figure out what is going on inside code at run time. I set a breakpoint where I need the execution to stop and then I can see the content of all variables, I think it could help you figure out the problem.

If not I am happy to do a live sessions on Hangout.

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024

@fabriziomoscon A live hangout session would be amazing. I was just going to ask you if I could hire you by the hour to help me out on this one! Let me know when you're available, when is a good time for you, and I will be there.

from react-native-twilio-programmable-voice.

dabit3 avatar dabit3 commented on June 8, 2024

I guess may main issue is that when this code block:

public void initWithAccessToken(final String accessToken) {
        Log.d(LOG_TAG, "TWILIOEVENT initWithAccessToken called. gcmToken: " + gcmToken);
        if (accessToken != "") {
            TwilioVoiceModule.this.accessToken = accessToken;
            if (gcmToken != null) {
                register();
            }
        }
    }

Gets called, gcmToken is never set, so I'm trying to find out why the gcmToken is not being set when the app is initialized.

from react-native-twilio-programmable-voice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.