urbanairship / android-library

Urban Airship Android SDK
Other
109 stars 123 forks source link

Infinite loop when using HMS #217

Closed barry-irvine closed 1 year ago

barry-irvine commented 1 year ago

Preliminary Info

What Airship dependencies are you using?

com.urbanairship.android:urbanairship-hms:16.7.1 com.urbanairship.android:urbanairship-automation:16.7.1 com.urbanairship.android:urbanairship-message-center:16.7.1

Device Huawei P40 Lite

Report

What unexpected behavior are you seeing?

After adding HMS to the Huawei variant of my project I see an infinite loop of AirshipWorker jobs and HMSSDK calls.

I suspect that AirshipHmsIntegration.processNewToken is re-triggering the events over and over again with the same token.

What is the expected behavior?

The new push token is registered only once.

I added this to the manifest and the infinite loop stopped - but this obviously stopped using the Airship component so I couldn't get any messages!

    <service android:name="com.huawei.hms.push.HmsMessageService" android:exported="false">
        <intent-filter>
            <action android:name="com.huawei.push.action.MESSAGING_EVENT"/>
        </intent-filter>
    </service>

What are the steps to reproduce the unexpected behavior?

Integrate an app with Huawei Push Kit and observe the logcat

Do you have logging for the issue?

2022-09-23 09:06:03.935 9699-9699/com.gocitypass.debug I/HMSSDK_PushReceiver: push receive broadcast message, Intent:com.huawei.android.push.intent.REGISTRATION pkgName:com.gocitypass.debug 2022-09-23 09:06:03.936 9699-9896/com.gocitypass.debug I/HMSSDK_PushReceiver: receive a push token: com.gocitypass.debug 2022-09-23 09:06:04.242 9699-9699/com.gocitypass.debug I/HMSSDK_PushReceiver: push receive broadcast message, Intent:com.huawei.android.push.intent.REGISTRATION pkgName:com.gocitypass.debug 2022-09-23 09:06:04.243 9699-9896/com.gocitypass.debug I/HMSSDK_PushReceiver: receive a push token: com.gocitypass.debug ...

2022-09-23 09:07:31.741 9699-9788/com.gocitypass.debug I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=f1d8efe0-678b-430b-a1ac-1828dc65e889, tags={ airship, com.urbanairship.job.AirshipWorker } ] 2022-09-23 09:07:32.068 9699-9777/com.gocitypass.debug I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=7d7b5977-0c3d-461e-b818-72f533dfecc8, tags={ airship, com.urbanairship.job.AirshipWorker } ] 2022-09-23 09:07:32.397 9699-9793/com.gocitypass.debug I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=c02d07fa-0362-44dd-a4d3-fcfaaf758e98, tags={ airship, com.urbanairship.job.AirshipWorker } ]

jyaganeh commented 1 year ago

Hi @barry-irvine, I'm looking into this currently and am seeing the same behavior on one of our internal testing apps. It's not clear to me if something changed with HMS or if this is some type of temporary issue, but I'll keep you posted with what I find out.

In the meantime, would you mind sharing the HMS Core Push SDK version you're using and the HMS Core version installed on your device?

barry-irvine commented 1 year ago

Hi Josh,

The device has HMS Core 6.7.0.321 running and I'm using push kit version 6.5.0.300

jyaganeh commented 1 year ago

@barry-irvine We just released v16.7.5, which includes a fix for this issue. Let me know if you're still seeing any unexpected behavior after updating.