我正在使用OneSignal android SDK进行推送通知。我们的目标是在屏幕锁定时显示抬头通知。 测试中的设备是具有Android 7.0版本的Samsung S6 Edge
我尝试将Priority设置为10和android_visibility。
还要在“单信号”控制台上设置一个类别,将“重要性”作为“紧急”,将“锁定屏幕”作为“公共”。
byte[] byteArray = Encoding.UTF8.GetBytes("{"
+ "\"app_id\": \"" + appId + "\","
+ "\"headings\": {\"en\": \"" + heading + "\"},"
+ "\"contents\": {\"en\": \"" + message + "\"},"
+ "\"include_player_ids\": [" + deviceIds + "],"
+ "\"priority\":10,"
+ "\"ios_badgeType\":\"Increase\","
+ "\"android_visibility\": 1,"
+ "\"android_channel_id\": \"" + android_channel_id + "\","
+ "\"ios_badgeCount\": 1 }");
锁定屏幕后,手机应亮起并显示提示通知。