Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getOpenSourceSoftwareLicenseInfo is returning null now

A trivial but annoying issue has come up in the last few days. Previously my menu option which popped up a dialog to show the legal text for using Google Services was very full (if a little slow to load), but now it is null with no change to the code..

GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
        int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
        if (resultCode == ConnectionResult.SUCCESS) {
            AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
            builder.setTitle("About");
            builder.setMessage(apiAvailability.getOpenSourceSoftwareLicenseInfo(this));
            builder.setPositiveButton("OK", null);
            builder.show();

        }

Is this a problem common to others, i.e. a new bug introduced by a Google update or some other possibility?

like image 799
Mark Sheekey Avatar asked May 17 '16 10:05

Mark Sheekey


4 Answers

according to https://code.google.com/p/gmaps-api-issues/issues/detail?id=9813

It appears that google changed the file name it was looking for from oss_notice to third_party_licenses. They basically broke getting the license info for any play services implementation below 9.0.0.

you will need to update the version to 9.0.0 to get the license info back for device with later versions of play services.

EDIT (June 6, 2016): Google is looking into the issue now.

Project Member #3 [email protected]

Thanks for the reports. We've filed this internally and will look into it.

Status: Accepted Labels: Internal-29143355

like image 176
Angel Koh Avatar answered Nov 13 '22 12:11

Angel Koh


Yes, upgrading Google Play Services to last version (9.0.0 at time of writing this answer) solves the issue.

I had the same problem and after upgrading Google Play Services I started getting the licenses properly.

like image 40
Guardiola31337 Avatar answered Nov 13 '22 12:11

Guardiola31337


If you're maintaining an old app and can't reasonably update from a very old version of Google Play Services without breaking a whole lot of ancient features, there's a viable workaround:

Decompile the getOpenSourceSoftwareLicenseInfo() method with Android Studio, copy the method into your project, and change the line to point from "oss_notice" to "third_party_licenses".

    Uri var1 = (new android.net.Uri.Builder()).scheme("android.resource").authority("com.google.android.gms").appendPath("raw").appendPath("oss_notice").build();

to

    Uri var1 = (new android.net.Uri.Builder()).scheme("android.resource").authority("com.google.android.gms").appendPath("raw").appendPath("third_party_licenses").build();
like image 31
TheGraeme Avatar answered Nov 13 '22 12:11

TheGraeme


This method has been deprecated and is no longer necessary: https://developers.google.com/android/reference/com/google/android/gms/common/GooglePlayServicesUtil.html#getOpenSourceSoftwareLicenseInfo(android.content.Context)

This license information is displayed in Settings > Google > Open Source on any device running Google Play services. Applications do not need to display this license text, and this method will be removed in a future version of Google Play services.

👍

like image 31
lenooh Avatar answered Nov 13 '22 13:11

lenooh