urbanairship / airship-flutter

Flutter integration
Other
17 stars 17 forks source link

Received message is ignored in terminated state #226

Open mcs-nuuk opened 1 day ago

mcs-nuuk commented 1 day ago

Preliminary Info

What Airship dependencies are you using?

Report

What unexpected behavior are you seeing?

When the app has been terminated on Android, I do not receive the first push message. Instead, I see the following message in the log: "Received message when push is disabled. Ignoring."

What is the expected behavior?

The expected behavior is that I should receive the first push message, even after the app has been terminated.

What are the steps to reproduce the unexpected behavior?

  1. Terminate the app on an Android device.
  2. Send a push notification to the device.
  3. Observe the log for the error message "Received message when push is disabled. Ignoring" and confirm that the message is not received.

Could you please tell me what causes this error message? The Channel ID is opted in and I never call Airship.push.setUserNotificationsEnabled(false).

rlepinski commented 1 day ago

The opt-in might be effected by either that enable flag or if you the push privacy manager flag is being disabled. Could you add a listener on Airship.plush.onNotificationStatusChanged and log the changes to the notification status. If that does not reveal the issue then we would need verbose logs to see whats going on

mcs-nuuk commented 21 hours ago

@rlepinski

Unfortunately, this didn't reveal the issue. That's the verbose log:

2024-10-29 09:24:53.243 30068-30068 UALib-Framework         pid-30068                            V  Failed to load config from properties file: Unable to apply config from file airshipconfig.properties
2024-10-29 09:24:53.245 30068-30090 xxx - UALib  pid-30068                            I  Airship taking off!
2024-10-29 09:24:53.245 30068-30090 xxx - UALib  pid-30068                            I  Airship log level: 2
2024-10-29 09:24:53.245 30068-30090 xxx - UALib  pid-30068                            I  UA Version: 18.3.3 / App key = yu7N5wgmR3OJr1VLbtX19A Production = false
2024-10-29 09:24:53.246 30068-30090 xxx - UALib  pid-30068                            V  UAirship - !SDK-VERSION-STRING!:com.urbanairship.android:urbanairship-core:18.3.3
2024-10-29 09:24:53.273 30068-30090 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.contacts.OPERATIONS
2024-10-29 09:24:53.274 30068-30099 xxx - UALib  pid-30068                            V  g - Removing preference: com.urbanairship.contacts.OPERATIONS
2024-10-29 09:24:53.275 30068-30090 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.contacts.OPERATIONS
2024-10-29 09:24:53.276 30068-30108 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.contacts.OPERATIONS value: [{"identifier":"20938e01-4a1a-45eb-9ab5-ead405dfc9ae","operation":{"TYPE_KEY":"RESET"},"timestamp":1730190293275}]
2024-10-29 09:24:53.290 30068-30090 xxx - UALib  pid-30068                            V  i - Found provider: FCM Push Provider 18.3.3
2024-10-29 09:24:53.293 30068-30090 xxx - UALib  pid-30068                            I  Airship ready!
2024-10-29 09:24:53.293 30068-30090 xxx - UALib  pid-30068                            D  Autopilot - Airship ready!
2024-10-29 09:24:53.314 30068-30108 xxx - UALib  pid-30068                            D  g - Processing pending execution queue update []
2024-10-29 09:24:53.402 30068-30068 xxx - UALib  pid-30068                            D  k - Checking permission status for display_notifications
2024-10-29 09:24:53.446 30068-30068 xxx - UALib  pid-30068                            V  AirshipWorker - Running job: JobInfo{action='ACTION_SEND', airshipComponentName='vk.f', isNetworkAccessRequired=true, minDelayMs=10000, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, work Id: 5e75014b-c0c8-4ae6-bfe3-81c16d5669a7 run attempt: 0
2024-10-29 09:24:53.447 30068-30068 xxx - UALib  pid-30068                            V  a - Running job: JobInfo{action='ACTION_SEND', airshipComponentName='vk.f', isNetworkAccessRequired=true, minDelayMs=10000, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, run attempt: 0
2024-10-29 09:24:53.448 30068-30068 xxx - UALib  pid-30068                            D  k - Permission display_notifications request result: granted
2024-10-29 09:24:53.459 30068-30068 xxx - UALib  pid-30068                            V  AirshipWorker - Running job: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, work Id: b3ea2277-12bd-44d7-988a-c953ba3e943e run attempt: 0
2024-10-29 09:24:53.460 30068-30068 xxx - UALib  pid-30068                            V  a - Running job: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, run attempt: 0
2024-10-29 09:24:53.460 30068-30068 xxx - UALib  pid-30068                            V  AirshipWorker - Running job: JobInfo{action='ACTION_UPDATE_CONTACT', airshipComponentName='fm.g', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[Contact.identify, Contact.update]}, work Id: 11b8843f-fa11-425e-b7b2-6446130a904a run attempt: 0
2024-10-29 09:24:53.460 30068-30068 xxx - UALib  pid-30068                            V  a - Running job: JobInfo{action='ACTION_UPDATE_CONTACT', airshipComponentName='fm.g', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[Contact.identify, Contact.update]}, run attempt: 0
2024-10-29 09:24:53.461 30068-30068 xxx - UALib  pid-30068                            V  AirshipWorker - Running job: JobInfo{action='ACTION_REFRESH', airshipComponentName='zn.f', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, work Id: 431d17e5-f8d6-4f7c-bd59-b63e09e65b93 run attempt: 0
2024-10-29 09:24:53.461 30068-30068 xxx - UALib  pid-30068                            V  a - Running job: JobInfo{action='ACTION_REFRESH', airshipComponentName='zn.f', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, run attempt: 0
2024-10-29 09:24:53.461 30068-30068 xxx - UALib  pid-30068                            V  AirshipWorker - Running job: JobInfo{action='ACTION_UPDATE_CHANNEL', airshipComponentName='dm.d', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, work Id: 1f355d12-0453-4be1-ab92-a24e022c48e1 run attempt: 0
2024-10-29 09:24:53.462 30068-30068 xxx - UALib  pid-30068                            V  a - Running job: JobInfo{action='ACTION_UPDATE_CHANNEL', airshipComponentName='dm.d', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, run attempt: 0
2024-10-29 09:24:53.462 30068-30090 xxx - UALib  pid-30068                            D  j - Push registration failed with error: FCM error Default FirebaseApp is not initialized in this process de.xxx.android. Make sure to call FirebaseApp.initializeApp(Context) first.. Will retry.
2024-10-29 09:24:53.462 30068-30090 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.push.REGISTRATION_TOKEN_KEY
2024-10-29 09:24:53.463 30068-30099 xxx - UALib  pid-30068                            V  g - Removing preference: com.urbanairship.push.REGISTRATION_TOKEN_KEY
2024-10-29 09:24:53.463 30068-30090 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.push.PUSH_DELIVERY_TYPE
2024-10-29 09:24:53.464 30068-30143 xxx - UALib  pid-30068                            V  g - Removing preference: com.urbanairship.push.PUSH_DELIVERY_TYPE
2024-10-29 09:24:53.465 30068-30090 xxx - UALib  pid-30068                            V  c - Finished: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]} with result: RETRY
2024-10-29 09:24:53.466 30068-30090 xxx - UALib  pid-30068                            V  a - Job finished. Job info: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, result: RETRY
2024-10-29 09:24:53.466 30068-30068 xxx - UALib  pid-30068                            D  k - Checking permission status for display_notifications
2024-10-29 09:24:53.468 30068-30142 xxx - UALib  pid-30068                            V  c - Finished: JobInfo{action='ACTION_REFRESH', airshipComponentName='zn.f', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]} with result: SUCCESS
2024-10-29 09:24:53.468 30068-30142 xxx - UALib  pid-30068                            V  a - Job finished. Job info: JobInfo{action='ACTION_REFRESH', airshipComponentName='zn.f', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, result: SUCCESS
2024-10-29 09:24:53.600 30068-30068 xxx - UALib  pid-30068                            D  k - Permission display_notifications request result: granted
2024-10-29 09:24:53.602 30068-30126 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.analytics.LAST_SEND
2024-10-29 09:24:53.605 30068-30146 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.analytics.LAST_SEND value: 1730190293601
2024-10-29 09:24:53.636 30068-30146 xxx - UALib  pid-30068                            E  Received message when push is disabled. Ignoring.
2024-10-29 09:24:53.644 30068-30126 xxx - UALib  pid-30068                            D  a - Sending analytics events. Request: Request(url=https://combine.asnapieu.com/warp9/, method=POST, auth=ChannelTokenAuth(channelId=7e95a181-804d-4719-885a-7c33fc057e49), body=GzippedJson(json=[{"event_id":"2f6760c7-c738-4e2f-b22c-8dbd1e9ab91c","time":"1730190274.161","data":{"daylight_savings":false,"carrier":"Willkommen","package_version":"5.0.40","connection_type":"wifi","connection_subtype":"","os_version":"14","session_id":"2a4ca000-3aa4-4aa7-aebc-5f1cd659d781","time_zone":3600,"lib_version":"18.3.3"},"type":"app_foreground"}]), headers={X-UA-Package-Version=5.0.40, X-UA-Channel-ID=7e95a181-804d-4719-885a-7c33fc057e49, X-UA-Sent-At=1730190293.642, X-UA-In-Production=false, X-UA-Locale-Language=de, X-UA-App-Key=yu7N5wgmR3OJr1VLbtX19A, X-UA-Channel-Opted-In=false, X-UA-Permission-display_notifications=granted, X-UA-Device-Model=Pixel 6 Pro, X-UA-Android-Version-Code=34, X-UA-Package-Name=de.xxx.android, X-UA-Channel-Background-Enabled=true, X-UA-Locale-Country=DE, X-UA-Lib-Version=18.3.3, X-UA-Push-Address=7e95a181-804d-4719-885a-7c33fc057e49, X-UA-Frameworks=flutter:8.0.1, X-UA-Device-Family=android, X-UA-Timezone=Europe/Berlin}, followRedirects=true) Events: [{"event_id":"2f6760c7-c738-4e2f-b22c-8dbd1e9ab91c","time":"1730190274.161","data":{"daylight_savings":false,"carrier":"Willkommen","package_version":"5.0.40","connection_type":"wifi","connection_subtype":"","os_version":"14","session_id":"2a4ca000-3aa4-4aa7-aebc-5f1cd659d781","time_zone":3600,"lib_version":"18.3.3"},"type":"app_foreground"}]
2024-10-29 09:24:53.665 30068-30142 xxx - UALib  pid-30068                            D  l - Identifying contact for channel 7e95a181-804d-4719-885a-7c33fc057e49 request: Request(url=https://device-api.asnapieu.com/api/contacts/identify/v2, method=POST, auth=GeneratedChannelToken(channelId=7e95a181-804d-4719-885a-7c33fc057e49), body=Json(json={"action":{"contact_id":"8a806851-63f7-43f3-a291-665a74a90afb","type":"resolve","possibly_orphaned_contact_id":"8a806851-63f7-43f3-a291-665a74a90afb"},"device_info":{"device_type":"android"}}), headers={Accept=application/vnd.urbanairship+json; version=3;}, followRedirects=true)
2024-10-29 09:24:53.954 30068-30146 xxx - UALib  pid-30068                            D  r - Identifying contact for channel 7e95a181-804d-4719-885a-7c33fc057e49 result: RequestResult(status=200, value=IdentityResult(contactId=8a806851-63f7-43f3-a291-665a74a90afb, isAnonymous=true, channelAssociatedDateMs=1730190274000, token=eyJhbGciOiJIUzM4NCJ9.eyJhdWQiOiJ5dTdONXdnbVIzT0pyMVZMYnRYMTlBIiwiaWF0IjoxNzMwMTkwMjkyLCJleHAiOjE3MzAxOTM4OTIsInN1YiI6IjhhODA2ODUxLTYzZjctNDNmMy1hMjkxLTY2NWE3NGE5MGFmYiIsInVhLXNjcCI6ImNvbnRhY3QifQ.2yG5QWOaDeKQwuudf0Yjo-08ogGS-Om47rN_3cylLEjs8A0f6j0WE9YKlwz5Y9wj, tokenExpiryDateMs=1730193893953), body={"ok":true,"contact":{"contact_id":"8a806851-63f7-43f3-a291-665a74a90afb","channel_association_timestamp":"2024-10-29T08:24:34","is_anonymous":true},"token":"eyJhbGciOiJIUzM4NCJ9.eyJhdWQiOiJ5dTdONXdnbVIzT0pyMVZMYnRYMTlBIiwiaWF0IjoxNzMwMTkwMjkyLCJleHAiOjE3MzAxOTM4OTIsInN1YiI6IjhhODA2ODUxLTYzZjctNDNmMy1hMjkxLTY2NWE3NGE5MGFmYiIsInVhLXNjcCI6ImNvbnRhY3QifQ.2yG5QWOaDeKQwuudf0Yjo-08ogGS-Om47rN_3cylLEjs8A0f6j0WE9YKlwz5Y9wj","token_expires_in":3600000}
                                                                                                    , headers={null=HTTP/1.1 200 OK, Alt-Svc=h3=":443"; ma=2592000,h3-29=":443"; ma=2592000, Cache-Control=max-age=0, Content-Length=447, Content-Type=application/vnd.urbanairship+json;version=3, Data-Attribute=token_expires_in, Date=Tue, 29 Oct 2024 08:24:52 GMT, Expires=Tue, 29 Oct 2024 08:24:52 GMT, Last-Modified=Tue, 29 Oct 2024 08:24:52 GMT, Via=1.1 google, X-Android-Received-Millis=1730190293951, X-Android-Response-Source=NETWORK 200, X-Android-Selected-Protocol=http/1.1, X-Android-Sent-Millis=1730190293844}, exception=null)
2024-10-29 09:24:53.955 30068-30146 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.contacts.LAST_CONTACT_IDENTITY_KEY
2024-10-29 09:24:53.956 30068-30145 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.contacts.LAST_CONTACT_IDENTITY_KEY value: {"resolve_date_ms":1730190293955,"contact_id":"8a806851-63f7-43f3-a291-665a74a90afb","is_anonymous":true}
2024-10-29 09:24:53.956 30068-30146 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.contacts.OPERATIONS
2024-10-29 09:24:53.960 30068-30096 xxx - UALib  pid-30068                            V  c - Finished: JobInfo{action='ACTION_UPDATE_CONTACT', airshipComponentName='fm.g', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[Contact.identify, Contact.update]} with result: SUCCESS
2024-10-29 09:24:53.961 30068-30096 xxx - UALib  pid-30068                            V  a - Job finished. Job info: JobInfo{action='ACTION_UPDATE_CONTACT', airshipComponentName='fm.g', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[Contact.identify, Contact.update]}, result: SUCCESS
2024-10-29 09:24:53.963 30068-30142 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.contacts.OPERATIONS value: []
2024-10-29 09:24:53.964 30068-30144 xxx - UALib  pid-30068                            I  PushManager - Push registration updated.
2024-10-29 09:24:53.964 30068-30144 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.push.PUSH_DELIVERY_TYPE
2024-10-29 09:24:53.964 30068-30144 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.push.REGISTRATION_TOKEN_KEY
2024-10-29 09:24:53.968 30068-30144 xxx - UALib  pid-30068                            V  v - Channel already up to date.
2024-10-29 09:24:53.969 30068-30144 xxx - UALib  pid-30068                            V  c - Finished: JobInfo{action='ACTION_UPDATE_CHANNEL', airshipComponentName='dm.d', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[]} with result: SUCCESS
2024-10-29 09:24:53.970 30068-30144 xxx - UALib  pid-30068                            V  a - Job finished. Job info: JobInfo{action='ACTION_UPDATE_CHANNEL', airshipComponentName='dm.d', isNetworkAccessRequired=true, minDelayMs=0, conflictStrategy=2, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, result: SUCCESS
2024-10-29 09:24:53.970 30068-30096 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.push.PUSH_DELIVERY_TYPE value: fcm
2024-10-29 09:24:53.971 30068-30144 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.push.REGISTRATION_TOKEN_KEY value: cmsrl3uZRwu8oTsBi6VydO:APA91bGqFLPjW3NnAHT1UVM6fyXy7WFHqbAYPtfI5qyMZAHguubxG4bIXxFmi3Bn1rMhSYCdUIDrLOlNDGOYOcLI61yeiASHh9T87RHovbNaZfdyevB7n7c
2024-10-29 09:24:54.082 30068-30126 xxx - UALib  pid-30068                            D  a - Analytics event response: Response(status=200, result=com.urbanairship.analytics.data.e@7cffece, body=, headers={null=HTTP/1.1 200 OK, Alt-Svc=h3=":443"; ma=2592000,h3-29=":443"; ma=2592000, Content-Length=0, Date=Tue, 29 Oct 2024 08:24:52 GMT, Via=1.1 google, X-Android-Received-Millis=1730190294080, X-Android-Response-Source=NETWORK 200, X-Android-Selected-Protocol=http/1.1, X-Android-Sent-Millis=1730190294025, X-UA-Max-Batch=500, X-UA-Max-Total=5120, X-UA-Max-Wait=604800000, X-UA-Min-Batch-Interval=60000})
2024-10-29 09:24:54.082 30068-30126 xxx - UALib  pid-30068                            D  d - Analytic events uploaded.
2024-10-29 09:24:54.086 30068-30126 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.analytics.MAX_TOTAL_DB_SIZE
2024-10-29 09:24:54.087 30068-30144 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.analytics.MAX_TOTAL_DB_SIZE value: 5242880
2024-10-29 09:24:54.088 30068-30126 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.analytics.MAX_BATCH_SIZE
2024-10-29 09:24:54.089 30068-30126 xxx - UALib  pid-30068                            V  g - Preference updated: com.urbanairship.analytics.MIN_BATCH_INTERVAL
2024-10-29 09:24:54.089 30068-30126 xxx - UALib  pid-30068                            V  c - Finished: JobInfo{action='ACTION_SEND', airshipComponentName='vk.f', isNetworkAccessRequired=true, minDelayMs=10000, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]} with result: SUCCESS
2024-10-29 09:24:54.089 30068-30126 xxx - UALib  pid-30068                            V  a - Job finished. Job info: JobInfo{action='ACTION_SEND', airshipComponentName='vk.f', isNetworkAccessRequired=true, minDelayMs=10000, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, result: SUCCESS
2024-10-29 09:24:54.114 30068-30096 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.analytics.MAX_BATCH_SIZE value: 512000
2024-10-29 09:24:54.116 30068-30144 xxx - UALib  pid-30068                            V  g - Saving preference: com.urbanairship.analytics.MIN_BATCH_INTERVAL value: 60000
2024-10-29 09:25:44.291 30068-30068 xxx - UALib  pid-30068                            V  AirshipWorker - Running job: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, work Id: b3ea2277-12bd-44d7-988a-c953ba3e943e run attempt: 1
2024-10-29 09:25:44.292 30068-30068 xxx - UALib  pid-30068                            V  a - Running job: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, run attempt: 1
2024-10-29 09:25:44.296 30068-30144 xxx - UALib  pid-30068                            V  c - Finished: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]} with result: SUCCESS
2024-10-29 09:25:44.296 30068-30144 xxx - UALib  pid-30068                            V  a - Job finished. Job info: JobInfo{action='ACTION_UPDATE_PUSH_REGISTRATION', airshipComponentName='com.urbanairship.push.j', isNetworkAccessRequired=false, minDelayMs=0, conflictStrategy=0, initialBackOffMs=30000, extras={}, rateLimitIds=[]}, result: SUCCESS
rlepinski commented 14 hours ago

At start I am seeing this:

D  j - Push registration failed with error: FCM error Default FirebaseApp is not initialized in this process de.xxx.android. Make sure to call FirebaseApp.initializeApp(Context) first.. Will retry.
V  g - Preference updated: com.urbanairship.push.REGISTRATION_TOKEN_KEY
V  g - Removing preference: com.urbanairship.push.REGISTRATION_TOKEN_KEY
V  g - Preference updated: com.urbanairship.push.PUSH_DELIVERY_TYPE
V  g - Removing preference: com.urbanairship.push.PUSH_DELIVERY_TYPE

Then later:

I  PushManager - Push registration updated.
V  g - Preference updated: com.urbanairship.push.PUSH_DELIVERY_TYPE
V  g - Preference updated: com.urbanairship.push.REGISTRATION_TOKEN_KEY
V  g - Saving preference: com.urbanairship.push.PUSH_DELIVERY_TYPE value: fcm
V  g - Saving preference: com.urbanairship.push.REGISTRATION_TOKEN_KEY value: cmsrl3uZRwu8oTsBi6VydO:APA91bGqFLPjW3NnAHT1UVM6fyXy7WFHqbAYPtfI5qyMZAHguubxG4bIXxFmi3Bn1rMhSYCdUIDrLOlNDGOYOcLI61yeiASHh9T87RHovbNaZfdyevB7n7c

I am guessing our SDK is doing a bad job at handling FCM not being ready at start and treating that error as an error in registration that clears the token, so its temp opted out when the push is processed.

Usually the fcm app is setup before our SDK runs, could you describe how you are setting up FCM?

mcs-nuuk commented 14 hours ago

@rlepinski Like this:

Future<void> main() async {
  final WidgetsBinding widgetsBinding =
      WidgetsFlutterBinding.ensureInitialized();

  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );

  Airship.takeOff(constants.airshipConfig);
rlepinski commented 14 hours ago

That code snippet will be useful to help reproduce, thanks you.

If you can use standard fcm initialization or move it the native side this issue will go away. The issue is the SDK takes off with cached configs during the app init to be ready to handle the push, since a push comes in before flutter is initialized.

Ill take a look at our registration code to see if we can just skip wiping the token if the FCM app is not ready.

rlepinski commented 5 hours ago

We are going to make a change in the native SDK to just retry without clearing the token if the firebase app is not setup. I am not sure yet the release timeline but hopefully this week.