Git Product home page Git Product logo

Comments (13)

EHRdev avatar EHRdev commented on September 6, 2024 2

I'm sorry, I found the solution but it's in native language (Java), since I'm not good at that language I haven't been able to adapt it in React Native, I was hoping that the creator of the library would help us.

SOLUTION IN JAVA: https://stackoverflow.com/questions/71285519/telephonymanager-listen-not-working-after-targetsdkversion-is-set-to-31-or-andro

from react-native-call-detection.

computerjazz avatar computerjazz commented on September 6, 2024 1

@EHRdev thanks for the SO link, here's a patch that incorporates it: https://gist.github.com/computerjazz/a2214c50b36cbb81f4a64e3405e9b60d

from react-native-call-detection.

computerjazz avatar computerjazz commented on September 6, 2024 1

as of android SDK 31 you now also need to request READ_PHONE_STATE permission or else this will silently fail/noop. See the end of the linked SO post: https://stackoverflow.com/a/71789261

you may need to install react-native-permissions or a similar package.

from react-native-call-detection.

EHRdev avatar EHRdev commented on September 6, 2024 1

I have just encountered this problem today, I used the patch suggested and it worked. However, I wonder why this patch was never applied and a version 1.10.0 was not delivered and that also this issue is closed?

Apparently the library's creator abandoned the project, android 12 has existed since last year with this problem and a few days ago the master computerjazz was the one who created the patch, I closed the issue myself because it solved the problem, but you're right, there should be a patch 1.10 that I doubt will arrive soon

from react-native-call-detection.

gusapc avatar gusapc commented on September 6, 2024

Hello, I have the same problem, did you find a solution?

from react-native-call-detection.

EHRdev avatar EHRdev commented on September 6, 2024

@EHRdev thanks for the SO link, here's a patch that incorporates it: https://gist.github.com/computerjazz/a2214c50b36cbb81f4a64e3405e9b60d

woooow bro, thank you very much, this is really great, thanks for sharing, I would never have been able to do it myself.

I had the opportunity to try it and it no longer gives an error <3, however it does not detect the events (Offhook, Disconnected, etc.), I use the code as it is in the documentation:

startListenerTapped = () => {
    this.callDetector = new CallDetectorManager((event, phoneNumber)=> {
      if (event === 'Offhook') {
        console.log('Offhook')
      }
      ...
}

from react-native-call-detection.

EHRdev avatar EHRdev commented on September 6, 2024

as of android SDK 31 you now also need to request READ_PHONE_STATE permission or else this will silently fail/noop. See the end of the linked SO post: https://stackoverflow.com/a/71789261

you may need to install react-native-permissions or a similar package.

I really appreciate the help friend, hopefully the creator of the library can apply the patch soon

from react-native-call-detection.

dprevost-LMI avatar dprevost-LMI commented on September 6, 2024

I have just encountered this problem today, I used the patch suggested and it worked. However, I wonder why this patch was never applied and a version 1.10.0 was not delivered and that also this issue is closed?

from react-native-call-detection.

Invictus-Munish avatar Invictus-Munish commented on September 6, 2024

Bro I am getting error in ContextCompat

`D:\munish\Desktop\Invictus\jra\node_modules\react-native-call-detection\android\src\main\java\com\pritesh\calldetection\CallDetectionManagerModule.java:60: error: cannot find symbol
telephonyManager.registerTelephonyCallback(ContextCompat.getMainExecutor(reactContext), callStateListener);
^
symbol: method getMainExecutor(ReactApplicationContext)
location: class ContextCompat
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.`

from react-native-call-detection.

Vantam1601 avatar Vantam1601 commented on September 6, 2024

telephonyManager.registerTelephonyCallback(reactContext.getMainExecutor(), callStateListener);

from react-native-call-detection.

marcesengel avatar marcesengel commented on September 6, 2024

@priteshrnandgaonkar would you mind pushing the update to npm if I prepare it or give me push access to the npm repo? https://www.npmjs.com/~marces

from react-native-call-detection.

imamrobani avatar imamrobani commented on September 6, 2024

@EHRdev what device are you using?
because I also got an error in Crashlytic about that, but when I tried to reproduce it in the emulator it didn't happen

from react-native-call-detection.

saurabh-sentieo avatar saurabh-sentieo commented on September 6, 2024

Again not working for Android 13 (API=33). READ_PHONE_STATE permission is always never_ask_again for this version.

from react-native-call-detection.

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.