Say, i have an app with APNs on. the app icon badge number is only up to the badge property of the APNs JSON payload, right ? That means if currently the app icon badge is 1, when a new push notification arrives, the app icon badge will be changed to the badge value of the JSON payload, but not auto increase by 1, if that right ? if so, is there an approach to do that auto increase. or is there a way to get the total notification count for an app in the notification center? Thanks.
1212 次
1 に答える
3
JSON ペイロードを使用して、実際にバッジ番号を設定しています。唯一の解決策は、「通知」が読み取られるたびにサーバーに通知することにより、サーバー側で管理することです。
通知として送信されるデータベース内のオブジェクトに「読み取り」フラグを追加する必要があります。たとえば、チャット アプリの場合: 新しいメッセージの通知を送信する場合、バッジの数は、そのユーザーの未読フラグがあるすべての会話の合計である必要があります。また、ユーザーが会話を読むたびに、サーバーで既読としてマークする API 呼び出しを行い、もちろんローカルでバッジ番号を減らす必要があります。
于 2013-08-13T08:37:08.657 に答える