[TIMOB-28008] Push Notifications: Subscribed Device not showing in Dashboard
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Done |
Resolution Date | 2020-10-02T15:17:34.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | arrow, dashboard, push, pushnotification, sdk9.0.3.ga |
Reporter | Antje Schattat |
Assignee | Abir Mukherjee |
Created | 2020-07-07T06:56:43.000+0000 |
Updated | 2020-10-02T15:17:34.000+0000 |
Description
Recently I have observed that a device is registered by the app but does not appear in the dashboard.
I get a DeviceToken (_retrieveDeviceToken_), the registration of the push channel (_PushNotifications.subscribeToken_) is also returned as success.
The app now thinks that signing up for the push messages was successful. However, since the device does not appear in the dashboard, the device does not receive any push messages.
Is this a bug? Or is this behavior more common in test versions (Android Distribute Build installed manually)?
Unfortunately, I haven't had the frequency of it yet.
Unfortunately, I cannot name a relationship between successful and unsuccessful registrations. But in my current tests, it happened 3-4 times. I delete the app and reinstall it. Then the device is theoretically created anew and the push channel is set. The app gets the success back, the device does not appear in the dashboard.
*Important update:* We did some tests today and found an unsightly bug. An existing app on Android10 (API 30) devices was deleted and reinstalled. After the new installation, the device is created again in the Axway dashboard and the push channel is registered. If a push message is sent to the device, it does not arrive. The following error appears in Push Notification Logs:
It is not possible to register the device for push notifications without deleting it immediately after sending the first Push notification. We urgently need a solution to this problem! thank you
[~aschattat] we are investigating this issue now, we will get this resolved at the earliest
We can't reproduce your issue. In fact, we're seeing the "opposite" problem. Every time you uninstall/re-install the app, a duplicate notification token is generated and added to the dashboard. Google has made a recent change where the previous token for the same token is no longer being unregistered. This causes duplicate notifications to be sent to the dashboard for the same device. You'll see a duplicate notification everytime your re-install the app (each re-install gets a new token). We have multiple customers experiencing this issue. Are you sure you don't have notifications disabled under system settings? That's what your error message suggests.
We have already successfully tested on some Android 10 Desvices. But unfortunately not on all of our test devices. Therefore, it is difficult for us to understand what the problem is. Here is the process again: Push notifications are activated and Android version 10 is used. 1. App is installed. 2. A push is sent via the API - status success. The error message appears in the push notification logs. 3. The device token is automatically deleted from the dashboard. Not from us. 4. A push is sent via the API, the error occurs (subscription not found). 5. User deletes the app and reinstalled it. 6. Registration of the device (device token) and push channel. Attention: Although the app has been deleted, the same device token appears to be used! 7. The device token is visible in the dashboard. 8. A push is sent via the API - status success. The error message appears in the push notification logs. 9. The device token is automatically deleted from the dashboard. Not from us. And so on ... vicious cycle ;-) In this case we have no chance to register the device again and send push notifications.
Our "Dashboard" will automatically delete the device token when you do a push and Google's server returns an HTTP error response. An error response will happen if the token has been unregistered, expired, or is invalid. So, our "Dashboard" will delete the token in this case since we know the token will never work. So, I'm thinking your app is unregistering the token somehow. Are you using any 3rd party modules that use Firebase? Anything that might be deleting the Firebase app instance? Because that would invalidate the token.
I created a firebase project for the app and transferred the server key and the sender ID to the dashboard. I copied the file google-services.json into the project. In the app I use the modules ti.cloud and ti.cloudpush to read the device token (retrieveDeviceToken) and to register the app (subscribeToken). That also works, I see the device in the dashboard. The push notification is sent via the API. First there is a login (https://api.cloud.appcelerator.com/v1/users/login.json) and then the push is sent (https://api.cloud.appcelerator.com/v1/push_notification/notify. json). The app key is included. The API returns a success. An error is displayed in the dashboard and in the push logs:
The device is not unregistered in the app or in the backend (with the API). We do not use any 3rd party modules. It works in the emulator (Android 10 API 30). However, a new device token is created each time the app is deleted. Some of our test devices (Android 10), despite deleting the app, do not create a new device token. That is the only difference I can see. Possibly. is that also the problem? Thank you for the amazing support.
[~aschattat], try downloading our pre-release "ti.cloudpush" module to see if it works for you. The below is being tested/reviewed now and works fine so far. Once it passes we'll make the below link public on our Dashboard. https://appcelerator-modules.s3.amazonaws.com/ti.cloudpush-android-7.1.0.zip Note that the above module only works with Titanium 9.0.1 and higher. You also have to add a "google-services.json" file to your Titanium project's "./platform/android" directory. Also note that it's normal for a new token to be generated after uninstalling/reinstalling the app. You'll end up with a duplicate token on the device. When you do a "push" from our Dashboard, the duplicate token will be automatically removed because it's been expired/unregistered and only the newest token for that device will be kept. (We still can't reproduce the issue where you say all tokens for that device have been removed though.)
I loaded the ti.cloudpush 7.1.0 and integrated it into the app. The device is added to the dashboard and there is a success in the push notification log. The error comes in the app as soon as the push is received. I now always get the following error:
But in the AndroidManifest.xml it is:
The error does not come with ti.cloudpush 7.0.0. Note: I send the push notification via Firebase.
According to ([https://developers.google.com/cloud-messaging/android/android-migrate-fcm](https://developers.google.com/cloud-messaging/android/android-migrate-fcm)), I deleted the described entries in the AndroidManifest.xml. Now the error doesn't come anymore. Now I will test the new ti.cloudpush 7.1.0 extensively. :-)
Glad you got it building. :) You actually don't need any of the GCM and APS related entries in the "tiapp.xml" file's AndroidManifest.xml section. The "ti.cloudpush" module will automatically inject the XML entries for you during the build (the old module version did the same). We also completely removed our GCM usage from "ti.cloudpush" 7.1.0.
Our first tests all worked. The customer will run additional tests today. But I am hopeful that everything will work out. Thank you for the good support and quick implementation.