Reporting APIs for custom notifications
Introduction
In two scenarios, you may need to create your own UI elements, such as notifications or pop-ups, to interact with users after you receive push data.
Send pass-through messages using Alibaba Cloud Mobile Push and process the push data in the `onMessage` callback.
Send notification messages using Alibaba Cloud Mobile Push and process the notification data yourself.
If you process push data yourself, you must handle the click, cancel, and delete events. Otherwise, the push statistics will be affected.
You can call the provided reporting APIs in the appropriate locations. For more information, see Mobile Push Android SDK: Best practices for pass-through messages and custom notifications.
If you do not process push data yourself, do not use the reporting APIs.
SDK V3.0.6 and later versions support the APIs on this page for reporting statistics.
API for reporting clicks on custom notifications
This API reports click events for custom notifications. Ensure that each message is reported only once.
clickMessage
API definition
void clickMessage(CPushMessage message)
Class
CloudPushService
Parameter description
Parameter | Type | Required | Description |
message | CPushMessage | Yes | The message instance for which to report the delete event. |
Code example
PushServiceFactory.getCloudPushService().clickMessage(cPushMessage)PushServiceFactory.getCloudPushService().clickMessage(cPushMessage);API for reporting deletions of custom notifications
This API reports deletion events for custom notifications. Ensure that each message is reported only once.
dismissMessage
API definition
void dismissMessage(CPushMessage message)
Class
CloudPushService
Parameter description
Parameter | Type | Required | Description |
message | CPushMessage | Yes | The message instance for which to report the deletion event. |
Code example
PushServiceFactory.getCloudPushService().dismissMessage(cPushMessage)PushServiceFactory.getCloudPushService().dismissMessage(cPushMessage);