Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getErrorDialog is depreciated. What is the updated function, and how might I use it?

Tags:

android

I am currently attempting to incorporate the use of Drive API authorisation into my app.

The Google Developers Guide states that I must use getErrorDialog in my Connection Failed method.

However, when I put the getErrorDialog in, it stated that the method was depreciated, and that I needed to use an 'updated' version.

It did not state, however, what I should use instead.

Does anyone know the updated version of this function?

like image 216
Mildwood Avatar asked Jul 14 '16 13:07

Mildwood


1 Answers

However, when I put the getErrorDialog in, it stated that the method was depreciated, and that I needed to use an 'updated' version.

GooglePlayServicesUtil.getErrorDialog has been deprecated in favour of GoogleApiAvailability.getErrorDialog , which is not a static method as it was for GooglePlayServicesUtil. You can get an instance of GoogleApiAvailability this way

GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();

and call getErrorDialog on the returned instance

apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show();

where this is a Context's object and resultCode is the return value of isGooglePlayServicesAvailable(Context). You can read more about it here

like image 124
Blackbelt Avatar answered Oct 30 '22 17:10

Blackbelt