在Android帐单活动中付款成功后没有任何反应

时间:2018-11-16 11:03:16

标签: android google-play in-app-billing

我正在应用购买中使用android anjlab。当用户尝试进行购买时,它成功了,但是代码却没有。当用户在购买后再次单击时,它成功了,但是由于激活的原因,他们必须这样做来获得贵宾身份。而且我不想这样工作。步骤如herehere

Anjlab libary

    @Override
                public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) {

                    if (productId.toString().equals("sinirsiz")) {
                    //It's need to give vip status to user but is didn't.I can't see any difference on firebase database.

                       myRef.child("Kullanıcılar").child(mAuth.getCurrentUser().getUid()).child("Kredi").setValue(Integer.toString(90000));
                        myRef.child("Kullanıcılar").child(mAuth.getCurrentUser().getUid()).child("VIP").setValue("Yes");
                        myRef.child("LIMITSIZLER").child(mAuth.getCurrentUser().getUid()).child("VIP").setValue("Dogrudur");
                        Toast.makeText(Buy.this, "VIP account enabled", Toast.LENGTH_SHORT).show();
                        startActivity(new Intent(getApplicationContext(), AnaEkran.class));
                    }  else if (productId.toString().equals("vip")) {
            //Same problem here.
                        myRef.child("Kullanıcılar").child(mAuth.getCurrentUser().getUid()).child("Kredi").setValue(Integer.toString(900));
                        myRef.child("Kullanıcılar").child(mAuth.getCurrentUser().getUid()).child("VIP").setValue("Yes");
                        myRef.child("VIPBABALAR").child(mAuth.getCurrentUser().getUid()).child("VIP").setValue("Aynen");
                        Toast.makeText(Buy.this, "VIP account enabled", Toast.LENGTH_SHORT).show();
                        startActivity(new Intent(getApplicationContext(), AnaEkran.class));
                    }  else if (productId.toString().equals("minivip")) {
                        //And here


                        myRef.child("Kullanıcılar").child(mAuth.getCurrentUser().getUid()).child("Kredi").setValue(Integer.toString(210));
                        myRef.child("Kullanıcılar").child(mAuth.getCurrentUser().getUid()).child("Minivip").setValue("Yes");

                        myRef.child("Minivipler").child(mAuth.getCurrentUser().getUid()).child("Minivip").setValue("Aynen");
                        Toast.makeText(Buy.this, "VIP account enabled", Toast.LENGTH_SHORT).show();
                        startActivity(new Intent(getApplicationContext(), AnaEkran.class));
                    }
                }

                @Override
                public void onPurchaseHistoryRestored() {

                }

                @Override
                public void onBillingError(int errorCode, @Nullable Throwable error) {

                }

                @Override
                public void onBillingInitialized() {

                }

我成功收到付款。我可以看到游戏机用户购买了物品,但是他们没有得到VIP。VIP功能由于某种原因没有被触发。用户购买了物品但没有得到状态

更新

有人在here上提供此代码,这样可以正常工作。我是否需要添加任何内容?

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (!bp.handleActivityResult(requestCode, resultCode, data))
            super.onActivityResult(requestCode, resultCode, data);
    }

0 个答案:

没有答案