Azure / azure-notificationhubs-java-backend

Azure Notification Hubs SDK for Java
https://docs.microsoft.com/en-us/azure/notification-hubs/
Apache License 2.0
35 stars 49 forks source link

[BUG] Can not send message to Baidu PNS server. #187

Open yunbozhang-msft opened 4 months ago

yunbozhang-msft commented 4 months ago

Describe the bug We are using 21v Azure China, and use Notification hub to push messages to Baidu PNS. Now, we can use following code to push messages to Baidu PNS, and Android devices can received notifications:

        BaiduNotification messageType1 = new BaiduNotification("{\"title\":\"test title\", \"description\":\"test description\"}");
        Notification messageType2 = Notification.createBaiduNotification("{\"title\":\"test title\", \"description\":\"test description\"}");

But actually, we want to use template send, as we need to both support to push notifications to APNS. So I write the following codes:

        Map<String, String> prop =  new HashMap<String, String>();
        prop.put("title", "测试2023");
        prop.put("description", "测试描述2023");
        Notification messageType3 = Notification.createTemplateNotification(prop);

        NotificationOutcome outcome = hub.sendNotification(messageType3);

But refer to my testing, can not use template to send messages to Baidu PNS.

Exception or Stack Trace Add the exception log and stack trace if available

No error, but my device can not receive notifications.

To Reproduce Steps to reproduce the behavior:

Please see my codes.

Expected behavior A clear and concise description of what you expected to happen.

My android device can receive notifications.

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issue as an incomplete report. Please do not provide any private information in this bug report.