Volume_Flutter icon indicating copy to clipboard operation
Volume_Flutter copied to clipboard

Support change volume in isolate mode

Open Ted-chiptech opened this issue 3 years ago • 1 comments

Will get this exception if I change the volume in the isolate mode.

E/MethodChannel#volume( 7076): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.setVolumeControlStream(int)' on a null object reference
E/MethodChannel#volume( 7076): 	at com.example.volume.VolumePlugin.controlVolume(VolumePlugin.java:97)
E/MethodChannel#volume( 7076): 	at com.example.volume.VolumePlugin.onMethodCall(VolumePlugin.java:80)
E/MethodChannel#volume( 7076): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#volume( 7076): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
E/MethodChannel#volume( 7076): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
E/MethodChannel#volume( 7076): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#volume( 7076): 	at android.os.MessageQueue.next(MessageQueue.java:332)
E/MethodChannel#volume( 7076): 	at android.os.Looper.loop(Looper.java:168)
E/MethodChannel#volume( 7076): 	at android.app.ActivityThread.main(ActivityThread.java:6878)
E/MethodChannel#volume( 7076): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#volume( 7076): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
E/MethodChannel#volume( 7076): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)

Ted-chiptech avatar Nov 08 '21 22:11 Ted-chiptech

Hi! I fixed this issue in my repo Use this in pubspec.yaml:

dependencies:
  volume:
    git:
      url: https://github.com/ZoltanTabi/Volume_Flutter
      ref: master

ZoltanTabi avatar Dec 22 '21 14:12 ZoltanTabi