Удаляю игру и ставлю заново.
При запуске игры, магазин успешно инициализируется и по логам видно, что покупка ЕСТЬ на сервере:
- Код: Выделить всё
07-28 18:30:20.134: I/UnityIAP(13921): Sku is owned: com.game.mysupergame_donate_pack_2
Но метод ProcessPurchase не вызывается, хотя судя по документации должен автоматически. Ручного восстановления покупок в Unity IAP не предусмотрено для Android.
Ради эксперимента попробуем вручную еще раз купить товар. Смотрим логи. Видим, что товар УЖЕ куплен и далее он нам успешно начисляется:
- Код: Выделить всё
07-29 10:33:07.716: I/UnityIAP(13543): Unable to buy item (response: 7:Item Already Owned)
07-29 10:33:07.716: I/UnityIAP(13543): Product purchased successfully!
Почему не работает автоматическое восстановление покупок и не вызывается ProcessPurchase?
Полные логи инициализации при запуске игры:
- Код: Выделить всё
07-28 18:30:20.114: I/UnityIAP(13921): Starting in-app billing setup.
07-28 18:30:20.122: I/UnityIAP(13921): Billing service connected.
07-28 18:30:20.123: I/UnityIAP(13921): invoking callback
07-28 18:30:20.123: I/UnityIAP(13921): Checking for in-app billing 3 support.
07-28 18:30:20.126: I/Finsky(7529): [2555] com.google.android.finsky.billing.iab.q.a(160): com.game.mysupergame: Account from first account - [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
07-28 18:30:20.127: I/UnityIAP(13921): In-app billing version 3 supported for com.game.mysupergame
07-28 18:30:20.129: I/Finsky(7529): [2554] com.google.android.finsky.billing.iab.q.a(160): com.game.mysupergame: Account from first account - [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
07-28 18:30:20.129: I/UnityIAP(13921): Subscriptions AVAILABLE.
07-28 18:30:20.130: I/UnityIAP(13921): onIabSetupFinished: 0
07-28 18:30:20.130: I/UnityIAP(13921): Requesting 4 products
07-28 18:30:20.130: I/UnityIAP(13921): QueryInventory: 4
07-28 18:30:20.131: I/UnityIAP(13921): invoking callback
07-28 18:30:20.131: I/UnityIAP(13921): Querying owned items, item type: inapp
07-28 18:30:20.131: I/UnityIAP(13921): Package name: com.game.mysupergame
07-28 18:30:20.131: I/UnityIAP(13921): Calling getPurchases with continuation token: null
07-28 18:30:20.133: I/Finsky(7529): [2579] com.google.android.finsky.billing.iab.q.a(160): com.game.mysupergame: Account from first account - [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
07-28 18:30:20.134: I/UnityIAP(13921): Owned items response: 0
07-28 18:30:20.134: I/UnityIAP(13921): Sku is owned: com.game.mysupergame_donate_pack_2
07-28 18:30:20.134: I/UnityIAP(13921): Continuation token: null
07-28 18:30:20.134: I/UnityIAP(13921): Querying SKU details.
07-28 18:30:20.137: I/Finsky(7529): [2555] com.google.android.finsky.billing.iab.q.a(160): com.game.mysupergame: Account from first account - [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
07-28 18:30:20.189: I/UnityIAP(13921): Got sku details: SkuDetails:{"productId":"com.game.mysupergame_donate_pack_1","type":"inapp","price":"21,99 грн.","price_amount_micros":21990000,"price_currency_code":"UAH","title":"1000 Coins","description":"Coins for ingame purchases"}
07-28 18:30:20.189: I/UnityIAP(13921): Got sku details: SkuDetails:{"productId":"com.game.mysupergame_donate_pack_2","type":"inapp","price":"43,99 грн.","price_amount_micros":43990000,"price_currency_code":"UAH","title":"Ads removing","description":"Remove all Ads in the game"}
07-28 18:30:20.190: I/UnityIAP(13921): Got sku details: SkuDetails:{"productId":"com.game.mysupergame_donate_pack_2","type":"inapp","price":"43,99 грн.","price_amount_micros":43990000,"price_currency_code":"UAH","title":"Ads removing","description":"Remove all Ads in the game"}
07-28 18:30:20.190: I/UnityIAP(13921): Got sku details: SkuDetails:{"productId":"com.game.mysupergame_donate_pack_3","type":"inapp","price":"149,99 грн.","price_amount_micros":149990000,"price_currency_code":"UAH","title":"Coins double + Ads removing","description":"Coins double + Ads removing"}
07-28 18:30:20.190: I/UnityIAP(13921): Got sku details: SkuDetails:{"productId":"com.game.mysupergame_donate_pack_4","type":"inapp","price":"439,99 грн.","price_amount_micros":439990000,"price_currency_code":"UAH","title":"Unlimited fuel + Coins double + Ads removing","description":"Unlimited fuel + Coins double + Ads removing"}
07-28 18:30:20.190: I/UnityIAP(13921): Querying owned items, item type: subs
07-28 18:30:20.190: I/UnityIAP(13921): Package name: com.game.mysupergame
07-28 18:30:20.190: I/UnityIAP(13921): Calling getPurchases with continuation token: null
07-28 18:30:20.192: I/Finsky(7529): [2554] com.google.android.finsky.billing.iab.q.a(160): com.game.mysupergame: Account from first account - [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
07-28 18:30:20.193: I/UnityIAP(13921): Owned items response: 0
07-28 18:30:20.193: I/UnityIAP(13921): Continuation token: null
07-28 18:30:20.193: I/UnityIAP(13921): Querying SKU details.
07-28 18:30:20.195: I/Finsky(7529): [2579] com.google.android.finsky.billing.iab.q.a(160): com.game.mysupergame: Account from first account - [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
07-28 18:30:20.271: I/UnityIAP(13921): onQueryInventoryFinished: true
07-28 18:30:20.271: I/UnityIAP(13921): Inventory refresh successful. (response: 0:OK)
07-28 18:30:20.507: I/Unity(13921): OnInitialized: PASS
07-28 18:30:20.511: I/art(13921): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.FloatingWebActionModeCallback>
07-28 18:30:20.512: I/art(13921): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.FloatingWebActionModeCallback>
07-28 18:30:20.513: I/Unity(13921): 1000 Coins , 21,99 грн., price_int21.99, iso: UAH
07-28 18:30:20.513: I/Unity(13921): Ads removing , 43,99 грн., price_int43.99, iso: UAH
07-28 18:30:20.513: I/Unity(13921): Coins double + Ads removing , 149,99 грн., price_int149.99, iso: UAH
07-28 18:30:20.514: I/Unity(13921): Unlimited fuel + Coins double + Ads removing , 439,99 грн., price_int439.99, iso: UAH
Unity 5.3.4
Тестировалось на Samsung Galaxy S5 и Nexus 7 2013 (Android 5).
Приложение работает в Google Play в альфе.