Comments (13)
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.
So it turns out the instructions in the README.md where wrong.
This commit fixes it
86b022d
from react-native-twilio-programmable-voice.
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.
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.
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.
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.
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.
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.
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.
- should the configuration be
com.google.android.gms:play-services-gcm:10.0.1
orcom.google.firebase:firebase-messaging:10.0.1
- 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.
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.
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.
@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.
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)
- Push notifications for missed calls and voicemail HOT 1
- How to handle conference calls HOT 1
- Failed to run the deviceDidReceiveIncoming method HOT 2
- Storing Device Token in Local Storage Causes Issues on Multiple Devices HOT 1
- App is not run on android simulator HOT 1
- Call Extension for contact
- Distinguish between ringing and answered? HOT 1
- Android 12 support HOT 5
- Voip call is not received in iOS HOT 1
- Phone Number showing in status bar while call is in progress HOT 1
- React Native android build failed while running app after install - npm install react-native-twilio-programmable-voice --save HOT 2
- incoming call failed in android
- CallKit error com.apple.CallKit.error.requesttransaction error 7
- Any listener like 'TwilioVoice.addEventListener('deviceReady') not working in IOS HOT 6
- How can I implement the call rejection function when the line is busy?
- How can I get call_state when I accepted a call? HOT 3
- Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. HOT 1
- android 12 error HOT 1
- Twilio Official Voice React Native SDK HOT 1
- Invalid Parametrs error on connect outgoing call HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-twilio-programmable-voice.