Skip to content

Can't open my app from background #25

@spacekestrel

Description

@spacekestrel

I am trying to implement alarm clock, using alarm manager and this package, but it gives me this message, when i trying to launch app from background:

E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): Failed to handle method call
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.app.Activity.getApplicationContext()' on a null object reference
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at com.pichillilorenzo.flutter_appavailability.AppAvailability.getAppPackageInfo(AppAvailability.java:93)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at com.pichillilorenzo.flutter_appavailability.AppAvailability.launchApp(AppAvailability.java:131)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at com.pichillilorenzo.flutter_appavailability.AppAvailability.onMethodCall(AppAvailability.java:57)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at android.os.Looper.loop(Looper.java:183)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#com.pichillilorenzo/flutter_appavailability( 4567): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 4567): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'android.content.Context android.app.Activity.getApplicationContext()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.app.Activity.getApplicationContext()' on a null object reference
E/flutter ( 4567): 	at com.pichillilorenzo.flutter_appavailability.AppAvailability.getAppPackageInfo(AppAvailability.java:93)
E/flutter ( 4567): 	at com.pichillilorenzo.flutter_appavailability.AppAvailability.launchApp(AppAvailability.java:131)
E/flutter ( 4567): 	at com.pichillilorenzo.flutter_appavailability.AppAvailability.onMethodCall(AppAvailability.java:57)
E/flutter ( 4567): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/flutter ( 4567): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/flutter ( 4567): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/flutter ( 4567): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 4567): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter ( 4567): 	at android.os.Looper.loop(Looper.java:183)
E/flutter ( 4567): 	at android.app.ActivityThread.main(ActivityThread.java:7656)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions