###前提・実現したいこと
https://github.com/anjlab/android-inapp-billing-v3
のライブラリを使用して定期購入を実装しましたがエラーが表示されてしまいます。
このエラーが表示されないようにするのにはどうすればいいでしょうか?
###該当のソースコード
見やすいように月額課金のコードのみ記載します。
public class MainActivity extends Activity implements BillingProcessor.IBillingHandler { //課金 BillingProcessor bp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //課金 // bp = new BillingProcessor(this, "自分のキー", this); bp = BillingProcessor.newBillingProcessor(this, "自分のキー", this); // See below on why this is a useful alternative //課金 } // IBillingHandler implementation // 課金 @Override public void onBillingInitialized() { /* * Called when BillingProcessor was initialized and it's ready to purchase */ //ここに定期購入のロジック{ if (!bp.isSubscribed("monthly00")) { bp.subscribe(this, "monthly00"); //} } } @Override public void onProductPurchased(String productId, TransactionDetails details) { /* * Called when requested PRODUCT ID was successfully purchased */ } @Override public void onBillingError(int errorCode, Throwable error) { /* * Called when some error occurred. See Constants class for more details * * Note - this includes handling the case where the user canceled the buy dialog: * errorCode = Constants.BILLING_RESPONSE_RESULT_USER_CANCELED */ //アプリを終了する onDestroy(); } @Override public void onPurchaseHistoryRestored() { /* * Called when purchase history was restored and the list of all owned PRODUCT ID's * was loaded from Google Play */ } @Override public void onDestroy() { if (bp != null) { bp.release(); } super.onDestroy(); } //課金 @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult Start"); Log.d(TAG, "requestCode: " + requestCode + " resultCode: " + resultCode + " data: " + data); IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); // null の場合 if (intentResult == null) { Log.d("TAG", "Weird"); super.onActivityResult(requestCode, resultCode, data); return; } } //課金 if (!bp.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data); } //課金 } }
###試したこと
実際に製品版としてアップロードして月額購入をしましたが、初回は月額購入ができて問題ありませんでしたが、アプリを再起動すると上記エラーがアプリを起動するたびに表示されます。
###補足情報(言語/FW/ツール等のバージョンなど)
特になし
あなたの回答
tips
プレビュー