Unfortunately, all proposed solutions still require checking the network connection before starting a payment request, which either provides a significant unnecessary delay when a user connects, or an even greater delay (waiting for a timeout) when the user is not connected or requires permission, which otherwise would be would not be all applications. Plus, as already noted, there is a danger of a false identification of the absence (or presence) of a network connection.
In addition, some versions of Google Play (for some versions of Android at least) already cope with the lack of a network connection (for example, Nexus7 displays a dialog called "Error" with the text "No connection", as you would expect and desire). And since the update process of the Google Play application is automated, it is hoped that Google will eventually solve this problem for those versions of the application that are currently exposing it, and when this happens, applications with aggressive solutions will want to have these solutions removed and will have unnecessary overhead until they do.
Given the foregoing, it is entirely possible that the best solution would be to simply add the selected text to the dialog or view that contains the button that the user uses to start the purchase, saying
"Please make sure your device is connected to the Internet. Click the" Back "button if you encounter any problems."
Pressing the back button on the gray screen appears to cause the screen to disappear, and calls onActivityResult () to call with RESULT_CANCELED, as if the user had canceled the payment dialog. so that the user exits the gray screen.
As low-tech as this approach, it seems to me that this is the best of many options.
source share