伙计们,我正在尝试从OneSignal推送通知中获取通知标题和正文,我曾尝试从JSON(如HTTP)中获取数据,但没有用
private Coroutine reScaleCoroutine;
private void OnTriggerEnter2D(Collider2D collision)
{
reScaleCoroutine = StartCoroutine(ReScale(new Vector3(.5f, .5f), new Vector3(0.1f, 0.1f), collision));
}
private void StopCoroutineMethod()
{
StopCoroutine(reScaleCoroutine);
}
答案 0 :(得分:1)
我已经解决了我的问题,它只是像这样获得通知的有效负载
OneSignal.shared
.setNotificationReceivedHandler((OSNotification notification) {
// will be called whenever a notification is received
print('Recived Notification is : $notification');
title = notification.payload.title;
body = notification.payload.body;
});
中解决方案的参考