In-App-Billing v3 is implemented in my Android App, with its Helpers.
When there's no network, I'm stuck on an ugly grey screen after initiating a purchase.
Is there a way to handle this in our app?
Currently, I disable purchases at launch when I don't receive SKU details from the Store. However, the connectivity can change after the launching. I have not found a way to know if Google Play Service was available or not.
Thanks for your help!
Similar issue: Which response code does in-app billing V3 return upon timeout?
New Google Play app v4.0.25 now properly handles this:
Like NIkolay has suggested, a workaround could be checking for connectivity prior to initiating the request.
If you want to try that, here's a piece of code that may help you;
First you will need to add some permissions to your AndroidManifest.xml file; specifically the android.permission.ACCESS_NETWORK_STATE or android.permission.ACCESS_WIFI_STATE.
ACCESS_NETWORK_STATE is needed for accessing ConnectivityManager (for network connections in general) and ACCESS_WIFI_STATE allows access to WifiManager (for managing Wi-Fi connectivity).
<!-- Needed for Reachability testing / wifi vs 3g uploading --> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Second, check out this method to determine network status
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (null == netInfo || !netInfo.isConnected()) {
return false;
}
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With