Start a new topic

InvokeMethod('requestPermissions') when used together with firebase_messaging

I have a project with Wikitude which was working as expected and I have recently added a firebase_messaging service to add push notification functionality on the app.

From the moment I have added the firebase_messaging (FCM) I get an error: 


E/MethodChannel#wikitude_plugin(18491): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkPermission(java.lang.String, int, int)' on a null object reference

E/MethodChannel#wikitude_plugin(18491): at com.wikitude.common.permission.a.a.checkPermissions(Unknown Source:33)

E/MethodChannel#wikitude_plugin(18491): at com.wikitude.wikitude_plugin.WikitudePlugin.permissionRequest(WikitudePlugin.java:92)

E/MethodChannel#wikitude_plugin(18491): at com.wikitude.wikitude_plugin.WikitudePlugin.onMethodCall(WikitudePlugin.java:60)

E/MethodChannel#wikitude_plugin(18491): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)

E/MethodChannel#wikitude_plugin(18491): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)

E/MethodChannel#wikitude_plugin(18491): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)

E/MethodChannel#wikitude_plugin(18491): at android.os.MessageQueue.nativePollOnce(Native Method)

E/MethodChannel#wikitude_plugin(18491): at android.os.MessageQueue.next(MessageQueue.java:335)

E/MethodChannel#wikitude_plugin(18491): at android.os.Looper.loop(Looper.java:207)

E/MethodChannel#wikitude_plugin(18491): at android.app.ActivityThread.main(ActivityThread.java:8676)

E/MethodChannel#wikitude_plugin(18491): at java.lang.reflect.Method.invoke(Native Method)

E/MethodChannel#wikitude_plugin(18491): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)

E/MethodChannel#wikitude_plugin(18491): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)


The code that inits the ARView with it's permissions isn't changed. I have tried to debug and the response from the  _channel.invokeMethod('requestARPermissions', features); within the requestARPermissions function rises the error.


Do you have any idea why this happens?

1 Comment

Hi,


In order to reproduce this I would need a bit more of information of your steps: Did you apply any changes to the code after adding the firebase_messaging service or did it just happen when adding the dependency to the yaml file? Are you trying to open the ARView in a different way? Could you reproduce the issue with more than 1 device? Which SDK version are you using?


Best regards,

Aitor.

Login or Signup to post a comment