Parse-SDK-Flutter icon indicating copy to clipboard operation
Parse-SDK-Flutter copied to clipboard

Configuring android app for parse push notifications

Open cool2apps opened this issue 2 years ago • 2 comments

New Issue Checklist

Issue Description

When configuring android app for parse push notification as described in this document: https://docs.parseplatform.org/parse-server/guide/#android-apps If I add this code to AndroidManifest.xml, app will crash if app receives an FCM message.

       <service
           android:name="com.parse.fcm.ParseFirebaseMessagingService"
           android:exported="false">
           <intent-filter>
               <action android:name="com.google.firebase.MESSAGING_EVENT"/>
           </intent-filter>
       </service>

Steps to reproduce

Actual Outcome

If I add that code to AndroidManifest.xml, app will crash if app receives an FCM message.

Expected Outcome

So I removed that code from AndroidManifest.xml, and tried again. This time app does not crash, if app receives an FCM message and looks like app is working fine without this code. No problem I faced by removing that code.

So what my app is missing by removing that code? Or documentation needs to be updated?

Environment

Parse Flutter SDK

  • SDK version: 5.0.1
  • Flutter version: 3.10.5
  • Dart version: 3.0.5
  • Operating system version: ubuntu server 22.04.2 LTS

Server

  • Parse Server version: 5.4.0

Logs

E/AndroidRuntime(32221): FATAL EXCEPTION: Firebase-Messaging-Intent-Handle
E/AndroidRuntime(32221): Process: com.company.appid, PID: 32221
E/AndroidRuntime(32221): java.lang.NullPointerException
E/AndroidRuntime(32221): 	at com.parse.PushRouter.getInstance(Unknown Source:15)
E/AndroidRuntime(32221): 	at com.parse.fcm.ParseFirebaseMessagingService.onMessageReceived(Unknown Source:89)
E/AndroidRuntime(32221): 	at com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage(Unknown Source:66)
E/AndroidRuntime(32221): 	at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk(Unknown Source:119)
E/AndroidRuntime(32221): 	at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(Unknown Source:12)
E/AndroidRuntime(32221): 	at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(Unknown Source:66)
E/AndroidRuntime(32221): 	at m6.g.lambda$processIntent$0(Unknown Source:1)
E/AndroidRuntime(32221): 	at m6.g.b(Unknown Source:0)
E/AndroidRuntime(32221): 	at m6.f.run(Unknown Source:6)
E/AndroidRuntime(32221): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/AndroidRuntime(32221): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
E/AndroidRuntime(32221): 	at l4.c.run(Unknown Source:6)
E/AndroidRuntime(32221): 	at java.lang.Thread.run(Thread.java:1012)
W/FlutterJNI(  897): FlutterJNI.loadLibrary called more than once
W/FlutterJNI(  897): FlutterJNI.init called more than once

cool2apps avatar Jun 21 '23 15:06 cool2apps

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

PS: I needed to add android:exported="false" to be able to compile for projects targeting android SDK 32 or newer. Maybe crash occurs because of that. But I can't compile, if I don't add "exported" part. I need to change targetSdkVersion to 30 in order to compile without android:exported="false". But target SDK 30 is too low to publish an app to Play Store.

cool2apps avatar Jun 21 '23 15:06 cool2apps