Check if user has an active subscription and then let him download wallpape

Am having trouble implementing a conditional structure for the BillingClient class method queryPurchases(String y) to check if user has an active subscription and let him download an image in the wallpaper app else prevent him from doing so. Am having trouble getting a comparison target for the if method here is the code am using

 case R.id.cv_download:
                //This is where the app's business logic goes
                //create a new BillingClient class
                 final BillingClient myclient= BillingClient.newBuilder(getActivity()).build();
                 //Establish connection to google play
                 myclient.startConnection(new BillingClientStateListener() {
                     @Override
                     public void onBillingSetupFinished(BillingResult billingResult) {
                         //The building client is ready you can setup purchases here
                         switch(billingResult.getResponseCode()){
                             case OK:
                                 myclient.queryPurchases(BillingClient.SkuType.SUBS);
                                 //I need a conditional structure here that lets me check if user has active
                                   subscription

                         }

                     }

                     @Override
                     public void onBillingServiceDisconnected() {
                    //Inform user that its not working and he should try some other time
                         Toast.makeText(getActivity(),"Connection Problems, Try Again Later",Toast.LENGTH_LONG).show();
                     }
                 });
                 //Implement conditional structure to check if user has subscription and then let him download

                 anImage      = ((BitmapDrawable) ivRandom.getDrawable()).getBitmap();
                saveImageToExternalStorage(anImage);
                Toast.makeText(getActivity(), "Download successfuly", Toast.LENGTH_SHORT).show();

                break;