When the application open then in your first activity
you can have this method for checking purchase done or not?
This is basic code to understand how to get inapp details, You may need to add security in this by using native or encryption.
public class HomeActivity extends Activity{
private IabHelper mIabHelper;
private void checkPurchase(){
String base64EncodedPublickey = "Your BASE 64 key";
if (mIabHelper == null) {
mIabHelper = new IabHelper(getActivity(), base64EncodedPublickey);
mIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(IabResult result) {
try {
if (result.isSuccess()) {
mIabHelper.queryInventoryAsync(mQueryFinishedListener);
}
} catch (IabHelper.IabAsyncInProgressException e) {
}
}
});
}
}
IabHelper.QueryInventoryFinishedListener
mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(final IabResult result, final Inventory inventory) {
Gson gson = new Gson();
try {
if (result.isFailure()) {
return;
}
if (inventory.hasPurchase("Package name")) {
Purchase purchase = inventory.getPurchase("Inapp Package name");
if (purchase != null) {
String puchaseDetails = gson.toJson(purchase);
Log.e(TAG, "Purchase Data : "+puchaseDetails);
}
}
} catch (Exception e) {
localData = null;
}
}
};
}