wumke / react-native-immediate-phone-call

Initiate immediate phone call (without further user interaction) for React Native on iOS and Android.
GNU General Public License v3.0
174 stars 51 forks source link

Attempt to invoke virtual method 'android.content.Context android.content.ContextWrapper.getApplicationContext()' on a null object reference #26

Closed khunghang16 closed 4 years ago

khunghang16 commented 5 years ago
Screen Shot 2019-06-07 at 10 36 21

I denied permission 3 or 4 step, then I authorization permission phone call, RNImmediatePhoneCall.immediatePhoneCall(phone); And I have bug . help me

wumke commented 5 years ago

So you did not grant permission to make phone calls? In that case you need to handle yourself what will happen in your app and not call the library.

bl1n0v commented 5 years ago

@wumke, greetings! Getting the same issue. Although I've granted the permission, double checked it with RN PermissionsAndroid module. What's the name of the permission? Is it CALL_PHONE or should it be something else (like PROCESS_OUTGOING_CALLS)?

wumke commented 5 years ago

I never use latest latest react-native versions in my projects due to other library constraints... which version do you guy's use? Which android version/sdk? (I've tested it on android 4.4, 5, 6, 7, 8 so I don't expect this to be an issue...)

If you find relevant info about deprecated things in react native that might break this library please keep me updated in this issue-thread!

somy001 commented 5 years ago

Hi, I am having the same error. On my side, the error appears randomly, but mainly when developing my app. After a hot reload, I always have this error when making a call. I need to restart my app and then it's ok. I also had a client that encounter this error in a published version of my app, so it is not only after a hot reload.

dbugshe2 commented 4 years ago

Hi, I was having this problem earlier, while running my app on an emulator, what worked for me was to turn off the wifi so as to fall back to using cellular, and for some reason (honestly, I don't know). it started to work again.

UPDATE: After a while (after live reloading, the error comes back again),

I think @wumke you might need to look at adding checks to all the places where you use reactContext and check to make sure you're not returning a null value. I'm not very experienced with java myself to handle it. Thanks

wumke commented 4 years ago

If I find some time I will look into this...

rcidt commented 4 years ago

@dbugshe2 @somy001 @iNane-nane @khunghang16

My PR for RN60 support fixes this issue. Please merge, @wumke

https://github.com/wumke/react-native-immediate-phone-call/pull/35/files#diff-d7fbde4e2d2304704aab596064e3daa5R40

https://github.com/wumke/react-native-immediate-phone-call/pull/35

wumke commented 4 years ago

Can the ones having the issue confirm the PR changes fix all problems? Then I will merge it (No time to review myself at the moment...)

Thanks for contributing!

dbugshe2 commented 4 years ago

Hi, So I've checked out the PR and tested it out in my app on an emulator. did a clean via android/gradelw clean and I didn't get the error at all even after live reloading multiple times(it usually crashes if I dial a number after a live reload) but maybe someone should try it out on a physical device to confirm once and for all

but I'd say merge and close for now