Code Monkey home page Code Monkey logo

flutter-phonecallstate's Introduction

phonecallstate

Flutter plugin to receive Phone Call State for both iOS and Android.

Update:

  • Modified pubspec.yaml file to Dart2+
  • Named version as 1.0.1
enum PhonecallState { incoming, dialing, connected, disconnected, none }
enum PhonecallStateError { notimplementedyet  }

...
  Phonecallstate  phonecallstate;
  PhonecallState phonecallstatus;
  
...

phonecallstate = new Phonecallstate();
    phonecallstatus = PhonecallState.none;


    phonecallstate.setIncomingHandler(() {
      setState(() {
        phonecallstatus = PhonecallState.incoming;
        phonecallstatuslog =  phonecallstatuslog.toString() + PhonecallState.incoming.toString()+"\n";
      });
    });

    phonecallstate.setDialingHandler(() {
      setState(() {
        phonecallstatus = PhonecallState.dialing;
        phonecallstatuslog =  phonecallstatuslog.toString() + PhonecallState.dialing.toString()+"\n";
      });
    });

    phonecallstate.setConnectedHandler(() {
      setState(() {
        phonecallstatus = PhonecallState.connected;
        phonecallstatuslog =  phonecallstatuslog.toString() + PhonecallState.connected.toString()+"\n";
      });
    });

    phonecallstate.setDisconnectedHandler(() {
      setState(() {
        phonecallstatus = PhonecallState.disconnected;
        phonecallstatuslog =  phonecallstatuslog.toString() + PhonecallState.disconnected.toString()+"\n";
      });
    });

    phonecallstate.setErrorHandler((msg) {

    });
    ```

flutter-phonecallstate's People

Contributors

ozc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flutter-phonecallstate's Issues

build apk failed

using
phonecallstate: ^1.0.1
build with
flutter build apk --release

  • log
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':phonecallstate:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  
\build\phonecallstate\intermediates\res\merged\release\values\values.xml:236: error: resource android:attr/fontVariationSe
ttings not found.
  
\build\phonecallstate\intermediates\res\merged\release\values\values.xml:237: error: resource android:attr/ttcIndex not fo
und.
  error: failed linking references.

Upgrade compileSdkVersion

Please update CompileSdkVersion as a 28 in build.gradle

And add

Gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

Flutter release build not generating

Execution failed for task ':phonecallstate:verifyReleaseResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

Android resource linking failed

 C:\Users\a\.gradle\caches\transforms-2\files-2.1\9611c12a11fb129c2d552e558222aed1\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.



 C:\Users\a\.gradle\caches\transforms-2\files-2.1\9611c12a11fb129c2d552e558222aed1\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

above error has come when generating release build in flutter

NullPointerException: Attempt to invoke virtual method

I am using
phonecallstate: ^1.0.1

the following exception rises in many devices, and it crashes the whole app

E/AndroidRuntime(28555): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.app.Activity.getSystemService(java.lang.String)' on a null object reference
E/AndroidRuntime(28555): 	at com.plusdt.phonecallstate.PhonecallstatePlugin.<init>(PhonecallstatePlugin.java:51)
E/AndroidRuntime(28555): 	at com.plusdt.phonecallstate.PhonecallstatePlugin.registerWith(PhonecallstatePlugin.java:41)
E/AndroidRuntime(28555): 	at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:68)
E/AndroidRuntime(28555): 	at dz.softart.tamejida.MainApplication.registerWith(MainApplication.java:24)
E/AndroidRuntime(28555): 	at be.tramckrijte.workmanager.BackgroundWorker$doWork$1.run(BackgroundWorker.kt:75)
E/AndroidRuntime(28555): 	at android.os.Handler.handleCallback(Handler.java:809)
E/AndroidRuntime(28555): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(28555): 	at android.os.Looper.loop(Looper.java:166)
E/AndroidRuntime(28555): 	at android.app.ActivityThread.main(ActivityThread.java:7555)
E/AndroidRuntime(28555): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(28555): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
E/AndroidRuntime(28555): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
I/zygote64(28555): Starting profile saver IsSaveProfileNow end.

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.