先週、一連のアプリ内購入のテストを行いましたが、すべて順調に進んでいます。ただし、チェックアウト時にコマンドをキャンセルしました。これは、Google Play がキャンセル通知を継続的に送信するためです。
どうやらgoogleplayは私の確認を理解せず、連続ループで通知してくれます。
onPurchaseStateChanged で、JSON 解析後:
ArrayList<String> confirmations = new ArrayList<String>();
for (Trans p : transactions)
{
[...]
if (p.purchaseState.ordinal() == PurchaseState.CANCELLED.ordinal())
confirmations.add(p.notificationId);
}
if (!confirmations.isEmpty())
{
final String[] notifyIds = confirmations.toArray(new String[confirmations.size()]);
confirmNotifications(context, notifyIds);
}
.
public static void confirmNotifications(Context context, String[] notifyIds)
{
final Intent intent = createIntent(context, Action.CONFIRM_NOTIFICATIONS);
intent.putExtra(EXTRA_NOTIFY_IDS, notifyIds);
context.startService(intent);
}
私は何を間違っていますか?