oppo 推送内容限制200字符大小

This commit is contained in:
heavyrian2012
2023-09-19 10:48:01 +08:00
parent 4588d65ed0
commit 0ebb8fbda0

View File

@@ -18,6 +18,7 @@ import javax.annotation.PostConstruct;
@Component
public class OppoPush {
private static final Logger LOG = LoggerFactory.getLogger(OppoPush.class);
private static final int OPPO_PUSH_MAX_CONTENT = 200;
@Autowired
OppoConfig mConfig;
@@ -81,6 +82,10 @@ public class OppoPush {
String[] arr = Utility.getPushTitleAndContent(pushMessage);
String title = arr[0];
String body = arr[1];
if(body != null && body.length() > OPPO_PUSH_MAX_CONTENT) {
body = body.substring(0, OPPO_PUSH_MAX_CONTENT-3);
body += "...";
}
notification.setTitle(title);
notification.setContent(body);