I an trying to get the tokens of a users subscription relating to my app by using the following
public static BillingProcessor bp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
bp.loadOwnedPurchasesFromGoogle();
}
But I get the following error and I am not sure why?
Attempt to invoke virtual method 'boolean com.anjlab.android.iab.v3.BillingProcessor.loadOwnedPurchasesFromGoogle()' on a null object reference
My main objetive is to get the subscription info/token so I can send it to my webserver
Thanks
CodePudding user response:
Try below code:
public static BillingProcessor bp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
bp=new BillingProcessor(this,"Your play console License key",this);//i think you are missing this line
bp.loadOwnedPurchasesFromGoogle();
}