urbanairship / airship-flutter

Flutter integration
Other
17 stars 17 forks source link

Android not getting pushes- Ios does. #60

Closed cookseym closed 4 years ago

cookseym commented 4 years ago

Preliminary Info

iOS channels registered successfully, and using the airship test push and send to specific device works. Android channels are registered successfully, but device does not receive pushes.
Using RAW FCM and google APIs, device is able to receive push. Airship console reports 0 pushes sent.

What Airship dependencies are you using?

airship_flutter: ^3.0.2

Report

What unexpected behavior are you seeing?

Pushes from airship console never reach intended audience- no logs.

What is the expected behavior?

Push received and shown in notification bar

What are the steps to reproduce the unexpected behavior?

  1. Configure a airship project with flutter sdk 3.0.2
  2. Register FCM from google firebase in airship project android channel
  3. Install app, push to newly configured channel id

Do you have logging for the issue?

No logs are outputted that show any adverse issues.

marc-scig commented 4 years ago

Hi @cookseym,

Thanks for letting us know. Despite the fact that there are no obvious issues shown in the logs, it would still be helpful to provide logs around takeOff and push registration since it will help us to trace what the SDK is doing. I can try to reproduce the issue tomorrow, but in the meanwhile the most helpful info would be those logs as well as the way you're configuring/enabling push in your code.

cookseym commented 4 years ago

@marc-scig I am following the instructions from the readme- and the sample app.

I have double checked that the app has push permissions and followed the troubleshooting guide here - https://support.airship.com/hc/en-us/articles/213492643-GCM-FCM-Troubleshooting-Guide

Here is the log:


Airship taking off!
Airship log level: 3
Airship ready!
14941-15000 D: Autopilot - Airship ready!
onAirshipReady
14941-15046 I: Inbox updated link
14941-15046 I:         "airship_channel_id": "b7c34f5c-c95a-4eda-8e9a-ba789d80ca1c
14941-15011 D: EventApiClient - Sending analytics events. Request: com.urbanairship.http.Request@e45c581 Events: [{"event_id":"7f088637-5807-4b08-91b8-c3625b63bf8d","time":"1596216743.776","data":{"session_id":"7d68adcf-4896-4b73-8312-51d880e42379","connection_type":"wifi","connection_subtype":""},"type":"app_background"}, {"event_id":"62116c3f-5e74-461e-a814-3ce7cdda1f22","time":"1596216750.994","data":{"daylight_savings":true,"carrier":"Android","package_version":"0.9.1","connection_type":"wifi","connection_subtype":"","os_version":"10","session_id":"759d98ad-3d25-401c-80e0-ecb7dc4d6250","time_zone":-18000,"lib_version":"13.1.0"},"type":"app_foreground"}]
BrianBatchelder commented 4 years ago

@cookseym : Are you callingAirship.setUserNotificationsEnabled(true)? Without that, Airship will still become ready and get a channel. The push will be received, which you can see using Airship.onPushReceived.listen(), but the push will not display.

BrianBatchelder commented 4 years ago

Look up your channel in the airship dashboard. Look in your project, under "Audience" -> "Contact Lookup". Ensure that it is opted-in. If it is, please enable verbose logging in your app and send us the log.

cookseym commented 4 years ago

@BrianBatchelder Thanks for the suggestions-
I am setting Airship.setUserNotificationsEnabled(true)

After debugging this- I see that anytime the firebase messaging dependency (current version is ^6.0.16) is included in the flutter project- pushes do not come to airship. There are several issues I see.

1) I am trying to get the FCM push id. I see in the callback for getting the channel id, there is event.registrationToken which gives me what I want- however, this callback doesn't happen if the channel is already created. Is there a way in your SDK to get the FCM reg id consistently?
2) If the dependency firebase-messaging is included in the project- the airship push never comes through. This is what was happening- we use another SDK which accesses firebase-messaging.

VERBOSE LOG:

Launching lib/main.dart on Android SDK built for x86 64 in debug mode...
Running Gradle task 'assembleAlphaDebug'...
✓ Built build/app/outputs/apk/alpha/debug/app-alpha-debug.apk.
Installing build/app/outputs/apk/app.apk...
I/FlutterAutopilot(12828): onAirshipReady
Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (greylist, reflection, allowed)
W/ise.slide.alph(12828): Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (greylist, reflection, allowed)
W/ise.slide.alph(12828): Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (greylist, reflection, allowed)
W/ise.slide.alph(12828): Accessing hidden method Landroid/util/LongArray;->get(I)J (greylist, reflection, allowed)
D - UALib(12828): Analytics - New session: 9608f3d1-3485-4f55-9faa-7789fa2513f5
V - UALib(12828): Analytics - Adding event: app_foreground
V - UALib(12828): PreferenceDataStore - Saving preference: com.urbanairship.application.metrics.LAST_OPEN value: 1596829390430
D - UALib(12828): Automation - Updating triggers with type: 1
D - UALib(12828): Automation - Updating triggers with type: 1
Debug service listening on ws://127.0.0.1:58107/CCFfBMr9_Lw=/ws
Syncing files to device Android SDK built for x86 64...
V - UALib(12828): EventManager - Requesting to schedule event upload with delay 10000 ms.
V - UALib(12828): EventManager - Scheduling upload in 10000 ms.
V - UALib(12828): AndroidJobScheduler: Scheduling jobInfo: JobInfo{action=ACTION_SEND, id=0, extras='{}', airshipComponentName='com.urbanairship.analytics.Analytics', isNetworkAccessRequired=true, initialDelay=10000, persistent=false} scheduleId: 3000000
V - UALib(12828): PreferenceDataStore - Saving preference: com.urbanairship.analytics.SCHEDULED_SEND_TIME value: 1596829400494
V - UALib(12828): AirshipService - Received intent: Intent { act=RUN_JOB cmp=com.raise.slide.alpha/com.urbanairship.job.AirshipService (has extras) }
V - UALib(12828): AirshipService - Running job: JobInfo{action=ACTION_REFRESH, id=10, extras='{}', airshipComponentName='com.urbanairship.remotedata.RemoteData', isNetworkAccessRequired=true, initialDelay=0, persistent=false}
V - UALib(12828): AirshipService - Received intent: Intent { act=RUN_JOB cmp=com.raise.slide.alpha/com.urbanairship.job.AirshipService (has extras) }
V - UALib(12828): AirshipService - Running job: JobInfo{action=ACTION_RICH_PUSH_MESSAGES_UPDATE, id=-1, extras='{}', airshipComponentName='com.urbanairship.messagecenter.MessageCenter', isNetworkAccessRequired=false, initialDelay=0, persistent=false}
I - UALib(12828): Refreshing inbox messages.
D - UALib(12828): Locale: en_US.
D - UALib(12828): Locales: [en_US].
V - UALib(12828): InboxJobHandler - Fetching inbox messages.
D - UALib(12828): System Locale: en_US.
D/HostConnection(12828): HostConnection::get() New Host Connection established 0x73fcafbe7fe0, tid 12943
D/HostConnection(12828): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
W/OpenGLRenderer(12828): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
D/HostConnection(12828): HostConnection::get() New Host Connection established 0x73fd91261080, tid 12948
D/eglCodecCommon(12828): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation(12828): eglCreateContext: 0x73fcafbe8080: maj 3 min 0 rcv 3
D/EGL_emulation(12828): eglMakeCurrent: 0x73fcafbe8080: ver 3 0 (tinfo 0x73fcb0442900)
D/HostConnection(12828): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
D/eglCodecCommon(12828): setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation(12828): eglCreateContext: 0x73fd91261120: maj 3 min 0 rcv 3
W/Gralloc3(12828): mapper 3.x is not supported
D/HostConnection(12828): createUnique: call
D/HostConnection(12828): createUnique: call
D/HostConnection(12828): HostConnection::get() New Host Connection established 0x73fcafbe81c0, tid 12943
D/HostConnection(12828): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
D/HostConnection(12828): HostConnection::get() New Host Connection established 0x73fd01538240, tid 12948
D/eglCodecCommon(12828): allocate: Ask for block of size 0x1000
D/eglCodecCommon(12828): allocate: ioctl allocate returned offset 0x3ffff6000 size 0x2000
D/HostConnection(12828): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
D/EGL_emulation(12828): eglMakeCurrent: 0x73fd91261120: ver 3 0 (tinfo 0x73fcb5d6c600)
V - UALib(12828): InboxJobHandler - Fetch inbox messages response: Response{responseBody='{
V - UALib(12828):   "messages" : [ ],
V - UALib(12828):   "badge" : 0
V - UALib(12828): }
V - UALib(12828): ', responseHeaders={null=[HTTP/1.1 200 OK], Alt-Svc=[clear], Cache-Control=[no-cache, no-store, must revalidate], Content-Type=[application/json;charset=utf-8], Date=[Fri, 07 Aug 2020 19:43:11 GMT], Transfer-Encoding=[chunked], Vary=[Accept-Encoding], Via=[1.1 google], X-Android-Received-Millis=[1596829391094], X-Android-Response-Source=[NETWORK 200], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1596829391032]}, status=200, lastModified=0}
I - UALib(12828): Received 0 inbox messages.
D - UALib(12828): Remote data not modified since last refresh
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_REFRESH, id=10, extras='{}', airshipComponentName='com.urbanairship.remotedata.RemoteData', isNetworkAccessRequired=true, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_RICH_PUSH_MESSAGES_UPDATE, id=-1, extras='{}', airshipComponentName='com.urbanairship.messagecenter.MessageCenter', isNetworkAccessRequired=false, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): AirshipService - Component finished job with startId: 1
V - UALib(12828): AirshipService - Component finished job with startId: 2
V - UALib(12828): AirshipService - All jobs finished, stopping with last startId: 2
V - UALib(12828): PreferenceDataStore - Saving preference: com.urbanairship.remotedata.LAST_REFRESH_TIME value: 1596829391164
D/EGL_emulation(12828): eglMakeCurrent: 0x73fcafbe8080: ver 3 0 (tinfo 0x73fcb0442900)
D/eglCodecCommon(12828): setVertexArrayObject: set vao to 0 (0) 1 0
I/OpenGLRenderer(12828): Davey! duration=978ms; Flags=1, IntendedVsync=3453132593894, Vsync=3453215927224, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=3453228743655, AnimationStart=3453228778655, PerformTraversalsStart=3453228853655, DrawStart=3454014701655, SyncQueued=3454015908655, SyncStart=3454017687655, IssueDrawCommandsStart=3454027078655, SwapBuffers=3454079575655, FrameCompleted=3454112664655, DequeueBufferDuration=22908000, QueueBufferDuration=1069000, 
V - UALib(12828): AndroidJobService - Running job: JobInfo{action=ACTION_UPDATE_TAG_GROUPS, id=6, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false}
V - UALib(12828): AndroidJobService - Running job: JobInfo{action=ACTION_REFRESH, id=10, extras='{}', airshipComponentName='com.urbanairship.remotedata.RemoteData', isNetworkAccessRequired=true, initialDelay=0, persistent=false}
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_UPDATE_TAG_GROUPS, id=6, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): AndroidJobService - Running job: JobInfo{action=ACTION_UPDATE_CHANNEL_REGISTRATION, id=5, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false}
V - UALib(12828): AndroidJobService - Running job: JobInfo{action=ACTION_UPDATE_ATTRIBUTES, id=11, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false}
I/Choreographer(12828): Skipped 54 frames!  The application may be doing too much work on its main thread.
D - UALib(12828): Remote data not modified since last refresh
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_REFRESH, id=10, extras='{}', airshipComponentName='com.urbanairship.remotedata.RemoteData', isNetworkAccessRequired=true, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): PreferenceDataStore - Saving preference: com.urbanairship.remotedata.LAST_REFRESH_TIME value: 1596829391777
V - UALib(12828): AirshipChannel - Channel already up to date.
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_UPDATE_CHANNEL_REGISTRATION, id=5, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_UPDATE_ATTRIBUTES, id=11, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false} with result: 0
D/EGL_emulation(12828): eglMakeCurrent: 0x73fd91261120: ver 3 0 (tinfo 0x73fcb5d6c600)
D/eglCodecCommon(12828): setVertexArrayObject: set vao to 0 (0) 1 0
I/System.out(12828): Not keeping screen on
V - UALib(12828): AirshipService - Received intent: Intent { act=RUN_JOB cmp=com.raise.slide.alpha/com.urbanairship.job.AirshipService (has extras) }
V - UALib(12828): AirshipService - Running job: JobInfo{action=ACTION_UPDATE_CHANNEL_REGISTRATION, id=5, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false}
V - UALib(12828): AirshipChannel - Channel already up to date.
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_UPDATE_CHANNEL_REGISTRATION, id=5, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): AirshipService - Component finished job with startId: 1
V - UALib(12828): AirshipService - All jobs finished, stopping with last startId: 1
W/ise.slide.alph(12828): Accessing hidden field Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe; (greylist, reflection, allowed)
W/ise.slide.alph(12828): Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, 
V - UALib(12828): AirshipService - Received intent: Intent { act=RUN_JOB cmp=com.raise.slide.alpha/com.urbanairship.job.AirshipService (has extras) }
V - UALib(12828): AirshipService - Running job: JobInfo{action=ACTION_UPDATE_CHANNEL_REGISTRATION, id=5, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false}
V - UALib(12828): AirshipChannel - Channel already up to date.
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_UPDATE_CHANNEL_REGISTRATION, id=5, extras='{}', airshipComponentName='com.urbanairship.channel.AirshipChannel', isNetworkAccessRequired=true, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): AirshipService - Component finished job with startId: 1
V - UALib(12828): AirshipService - All jobs finished, stopping with last startId: 1

V - UALib(12828): AndroidJobService - Running job: JobInfo{action=ACTION_UPDATE_PUSH_REGISTRATION, id=4, extras='{}', airshipComponentName='com.urbanairship.push.PushManager', isNetworkAccessRequired=false, initialDelay=0, persistent=false}
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_UPDATE_PUSH_REGISTRATION, id=4, extras='{}', airshipComponentName='com.urbanairship.push.PushManager', isNetworkAccessRequired=false, initialDelay=0, persistent=false} with result: 0
V - UALib(12828): AndroidJobService - Running job: JobInfo{action=ACTION_SEND, id=0, extras='{}', airshipComponentName='com.urbanairship.analytics.Analytics', isNetworkAccessRequired=true, initialDelay=10000, persistent=false}
V - UALib(12828): PreferenceDataStore - Saving preference: com.urbanairship.analytics.LAST_SEND value: 1596829403713
D - UALib(12828): EventApiClient - Sending analytics events. Request: com.urbanairship.http.Request@a726888 Events: [{"event_id":"3840dbcc-9c9f-4e2a-8a6f-0c8bcbe952e2","time":"1596829390.430","data":{"daylight_savings":true,"carrier":"Android","package_version":"0.9.1","connection_type":"wifi","connection_subtype":"","last_metadata":"eyJ2ZXJzaW9uX2lkIjoxLCJ0aW1lIjoxNTk2ODI4MTE5OTkyLCJwdXNoX2lkIjoiY2JjMGQ0MGItYjc1ZS00MjM2LWFjZDgtNzdlYzMwNGFlMDkxIiwiY2FtcGFpZ25zIjp7ImNhdGVnb3JpZXMiOltdfX0=","os_version":"10","session_id":"9608f3d1-3485-4f55-9faa-7789fa2513f5","time_zone":-18000,"lib_version":"13.1.0"},"type":"app_foreground"}]
D - UALib(12828): EventApiClient - Analytics event response: Response{responseBody='', responseHeaders={null=[HTTP/1.1 200 OK], Alt-Svc=[clear], Content-Type=[application/json], Date=[Fri, 07 Aug 2020 19:43:23 GMT], Transfer-Encoding=[chunked], Via=[1.1 google], X-Android-Received-Millis=[1596829403858], X-Android-Response-Source=[NETWORK 200], X-Android-Selected-Protocol=[http/1.1], X-Android-Sent-Millis=[1596829403813], X-UA-Max-Batch=[500], X-UA-Max-Total=[5120], X-UA-Max-Wait=[604800000], X-UA-Min-Batch-Interval=[60000]}, status=200, lastModified=0}
D - UALib(12828): EventManager - Analytic events uploaded.
V - UALib(12828): Job - Finished: JobInfo{action=ACTION_SEND, id=0, extras='{}', airshipComponentName='com.urbanairship.analytics.Analytics', isNetworkAccessRequired=true, initialDelay=10000, persistent=false} with result: 0
rlepinski commented 4 years ago

@cookseym My guess is that the other firebase dependency is registering a firebase service that is higher priority than ours. Unfortunately only 1 service is able to receive a messages for an app. See https://docs.airship.com/platform/android/getting-started/#extending-the-firebasemessagingservice

You could modify ours in the manifest to be higher priority but that would prevent the other dependency from working fully. You will either have to drop one of the plugins, make airship higher priority (breaking the other one), or write native code to forward messages to both. For the token we can add a new method in a future release.