Giter VIP home page Giter VIP logo

Comments (16)

Naveen-g09 avatar Naveen-g09 commented on July 28, 2024 1

is there a way to do it directly in expo?

from react-native-immediate-phone-call.

jonybar9 avatar jonybar9 commented on July 28, 2024

Same here
ran the following commands on a freshly opened react-native project:

`npm install react-native-immediate-phone-call --save

react-native link react-native-immediate-phone-call`

Then when using the following, nothing happens

import RNImmediatePhoneCall from 'react-native-immediate-phone-call'; .... RNImmediatePhoneCall.immediatePhoneCall('0123456789'); ...

from react-native-immediate-phone-call.

coloredlambda avatar coloredlambda commented on July 28, 2024

Confirmed, nothing happens...

from react-native-immediate-phone-call.

wumke avatar wumke commented on July 28, 2024

Well, do you guys use the latest RN version? Linking has changed for ios and I did not use or test this myself... that might be the issue...

from react-native-immediate-phone-call.

jonybar9 avatar jonybar9 commented on July 28, 2024

@wumke
I was using android, but maybe that's the issue, cause I was using the latest RN
I'll try downgrading and will update on the results

Thanks for replying

from react-native-immediate-phone-call.

wumke avatar wumke commented on July 28, 2024

If you find the solution feel free to send a pull request for the README !

from react-native-immediate-phone-call.

murbanowicz avatar murbanowicz commented on July 28, 2024

Have you managed to get it working @R44J / @jonybar9 / @Sidharth1999 ?
I am trying to make it work with latest RN and no success :(

from react-native-immediate-phone-call.

billel-boudchicha avatar billel-boudchicha commented on July 28, 2024

@murbanowicz try wrap the call in try catch block

from react-native-immediate-phone-call.

jonybar9 avatar jonybar9 commented on July 28, 2024

Ok I think I figured it out, I'll upload later what I did differently
@wumke could you contact me at [email protected] about making a pull request?

from react-native-immediate-phone-call.

jonybar9 avatar jonybar9 commented on July 28, 2024

Ok so @wumke didn't contact me so I'll just post my solution here and if one of you has the time make a pull request

First do react-link
Then add the following lines:

In settings.gradle:
after rootProject.name = 'YOUR_PROJ_NAME'
add the following line: include ':react-native-immediate-phone-call', ':app'

In build.gradle:
Inside the dependencies section insert the following line:
implementation project(':react-native-immediate-phone-call')

In AndroidManifest.xml:
add the following line with all other user-permissions
<uses-permission android:name="android.permission.CALL_PHONE" />

In MainActivity.java:
inside the class MainActivity add the following override:
(include the "@OverRide" for some reason it's not in the same block with the rest of the code)
`@Override

public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    
    RNImmediatePhoneCallPackage.onRequestPermissionsResult(requestCode, permissions, grantResults); // very important event callback
    
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);

}   

from react-native-immediate-phone-call.

sankaSanjeeva avatar sankaSanjeeva commented on July 28, 2024

@jonybar9, Thanks. It works. But I think you have missed importing this
import com.github.wumke.RNImmediatePhoneCall.RNImmediatePhoneCallPackage;
in MainActivity.java

from react-native-immediate-phone-call.

Habinezajanvier avatar Habinezajanvier commented on July 28, 2024

Hello @wumke, and @jonybar9, using the same way it's not working as expected

  • In the emulator, it's not doing anything but only requesting user permissions for calls
  • In a real android device after getting permissions, it directs to the phone dialer which is not what I want

Here are some details on my project

  • React-native version: 0.68.0
  • React-native-immediate-phone-call version: ^2.0.0

from react-native-immediate-phone-call.

jonybar9 avatar jonybar9 commented on July 28, 2024

@Habinezajanvier Sorry to hear that.
You're right that directing you to the dialer is not the expected behavior, it should make a direct call.
Sadly I won't have the time to dive deeper into it anytime soon

from react-native-immediate-phone-call.

wumke avatar wumke commented on July 28, 2024

Maybe the newer Android versions also blocked direct calling, and forward us to the dailer now (just like Apple did before, see readme). It is possible that there is no longer an option to immediately start a call without an intermediate action/confirmation.

If someone knows a solution, feel free to create a pull request.
Also, pull requests for the Readme with exact Android/iOS versions that are reported to work are very welcome!

from react-native-immediate-phone-call.

thepragmaticidealist avatar thepragmaticidealist commented on July 28, 2024

I've experienced the same in expo once I built the .apk using eas build. When I tap the button that should start the phone call, nothing happens. @wumke would you know what the issue is and how to fix it?

I followed the readme by adding "permissions": [ "android.permission.CALL_PHONE" ] to my app.json then calling RNImmediatePhoneCall.immediatePhoneCall(phoneNumber) where phoneNumber is the number the user wants to call.

from react-native-immediate-phone-call.

thepragmaticidealist avatar thepragmaticidealist commented on July 28, 2024

I managed to make this work but had to use React Native CLI instead of expo. After doing some research on the expo icebox and the expo intent launcher package it seems that at the moment expo has no way for us to ask the user for the CALL_PHONE permission. Nevertheless, the API is still supported by Android so, if you install the package through RN CLI, the functionality works.

from react-native-immediate-phone-call.

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.