I'm working on android anjlab in app purchasing.When a user attempts to make a purchase it is successful but code is not.Its success when user click again after purchasing.But they have to do that for a reason for activated to vip status.And i don't want to work like this.Steps work's as mentioned here And here
@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() {
}
I recived payment succesfuly.I can see the play console user has purcahed to item,but they don"t get the vip.The vip function it's not triggered for whatever reason.Users has purchased the item but they don't get the status
UPDATE
Somebody give this code on here Is will work like this.Do i need to add anything ?
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (!bp.handleActivityResult(requestCode, resultCode, data))
super.onActivityResult(requestCode, resultCode, data);
}