getOpenSourceSoftwareLicenseInfo is returning null now - android

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?

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 l...#google.com
Thanks for the reports. We've filed
this internally and will look into it.
Status: Accepted Labels:
Internal-29143355

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.

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();

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.
đź‘Ť

Related

Android Google billing integration - Client does not support ProductDetails

On trying to migrate Google billing integration from version 4 to 5, I'm getting an error 'Client does not support ProductDetails' on calling queryProductDetailsAsync.
List<QueryProductDetailsParams.Product> productList = List.of(QueryProductDetailsParams.Product.newBuilder()
.setProductId("ppgapp1")
.setProductType(BillingClient.ProductType.SUBS)
.build());
QueryProductDetailsParams params = QueryProductDetailsParams.newBuilder()
.setProductList(productList)
.build();
billingClient.queryProductDetailsAsync(params, listener);
Are there any changes needed to be made on the console on migration?
And how long it'll take to complete review on submitting to closed or internal test track for Google billing integration?
I face same issue when my emulator PlayStore application version is too old (in my case it is 23.0.21...)
Update PlayStore application to newer version will solve the problem (30.9.0...)
Here is how to update the Play Store app
If you want to guide user to update the PlayStore app, you can do like
billingClient.queryProductDetailsAsync(productParams) { billingResult, productDetails ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.FEATURE_NOT_SUPPORTED) {
Log.e("TAG", "Feature not supported ")
runOnUiThread {
Toast.makeText(this#MainActivity, "Please update PlayStore app", Toast.LENGTH_LONG).show()
// or AlertDialog or any error message
}
return#queryProductDetailsAsync
}
...
}
I had experienced the same problem. I couldn't find any information on why the problem is occurring. You can use it after checking whether the ProductDetail feature is supported.
BillingResult billingResult = billingClient.isFeatureSupported( BillingClient.FeatureType.PRODUCT_DETAILS );
if ( billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK ) {
// use billingClient.queryProductDetailsAsync()
}
Getting this error when I use google play version 21.2.12-21. When I use the 31.2.29-21 version of google play on another device, the item can be successfully queried. I can't use the 5.0 version of the billing library because it affects the user's payment
Issue resolved
Issue was occuring on one device and not occuring on another device with latest library.
Upon debuging I used old library on device where issue was occuring. And it was working fine on old library.
So after alot of trouble shoot I do following to resolve issue on that device with latest library code.
On device where issue is occurred
Do following
Update device OS update if there is any. In my case there was security patch update. Notification was there to update.
update play store if already not updated
Then clear data storage of play store app under setting of play store app. Then force stop play store app and then open play store app
uninstall and reinstall the android app again
After that my app shows product details as well as purchase pop up with latest billing library.
Thank you
I had to reinstall the app for the Billing client to recognize the supported product ID. I imagine that simply purged some stale cache behind the scenes.

In-App Update gives InstallException (ERROR_API_NOT_AVAILABLE)

Implemented in-app update feature, using the following code snippet:
private void showInAppUpdateDialog(boolean isMandatoryUpdate) {
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
|| appUpdateInfo.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS) {
int appUpdateType = isMandatoryUpdate ? IMMEDIATE : AppUpdateType.FLEXIBLE;
int requestCode = isMandatoryUpdate ? REQUEST_APP_UPDATE_IMMEDIATE : REQUEST_APP_UPDATE_FLEXIBLE;
if (appUpdateInfo.isUpdateTypeAllowed(appUpdateType)) {
// start the app update
try {
appUpdateManager.startUpdateFlowForResult(appUpdateInfo, appUpdateType, targetActivity, requestCode);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}
}
}).addOnFailureListener(e -> {
e.printStackTrace();
});
}
I am testing in-app update on the device which has Android 9. Still, it is giving me following an error (ERROR_API_NOT_AVAILABLE):
com.google.android.play.core.install.InstallException: Install Error(-3): The API is not available on this device. (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_API_NOT_AVAILABLE)
at com.google.android.play.core.appupdate.i.a(Unknown Source:24)
at com.google.android.play.core.internal.o.a(Unknown Source:13)
at com.google.android.play.core.internal.j.onTransact(Unknown Source:22)
at android.os.Binder.execTransact(Binder.java:731)
It is saying that check the following link:
https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_API_NOT_AVAILABLE)
Using Play core library version: 1.6.5
Latest core library version:
implementation 'com.google.android.play:core:1.7.0'
However, I am not able to get why it is saying that ERROR_API_NOT_AVAILABLE. Any help would be appreciated!
Firstly, please check that you are using the latest version of the play library.
Secondly, understated fact: Please check the app you are testing has the same package name which is available on the play store.
Example:
You have an app on the play store with package name com.example.app but you are testing your app with package name com.example.app.debug. You will get this error: ERROR_API_NOT_AVAILABLE
Note: You need to have at least one version of your app on the play store when you are testing.
On top of what Vipal suggested, the issue may be due to a signature mismatch between the version you have installed on the device and the one that Play Store would deliver (this is a common issue if you try to test it with debug builds). See https://developer.android.com/guide/playcore/in-app-updates#troubleshoot
Recently the Play Core API started returning an API_NOT_AVAILABLE error if the app is not owned by the user or the signatures mismatch, while before it used to return a successful UPDATE_NOT_AVAILABLE Task.
The recommendation is:
if you use the Kotlin Extension, make sure that you are catching the exception thrown by requestAppUpdateInfo
if you use PlayCore Java, make sure you have an onFailureListener that handles failures from getAppUpdateInfo
in order to test a debug build, you can use Internal App Sharing, as explained here: https://developer.android.com/guide/playcore/in-app-updates#internal-app-sharing
Source: I work on the Play Core team
My app was working fine before today, but I started getting this error today. One temporary workaround is to clear your Google Play Store cache and storage and then try launching the app. For me, it works only the first time, but fails afterwards. Before launching the app again, I have to clear the cache and storage again. I think there is something wrong on Google Play Store side due to which this issue is happening because everything was fine for me before today.
Got the same error, tried all solutions described here, nothing works.
App installed from Play Store Internal Test track with Version Code 267, then submitted new update to the same track with Version Code 268.
Play Store shows available update but the application still says ERROR_API_NOT_AVAILABLE
Clear Play Store data and cache does not help.
Description of ERROR_API_NOT_AVAILABLE say that it means “API is not available on device”
After carefully reading again this page, I have noticed that “in-app updates support apps running on only Android mobile devices and tablets, and Chrome OS devices”
Android TV not mentioned, I think it’s the reason in my case.
Temporary workaround for the moment is to surround the OnCompleteListener with a :
try {...} catch(e: RuntimeExecutionException) {...}
Just to avoid having to clear the PlayStore cache everytime I relaunch the app
After long time of debugging. I found, this is because of we are testing the app directly in mobile. Even though we generate and use signed apk, this error will occur.
The only way to get rid of this error is, we need to download the app from google play.
We can use Internal app sharing to test or simply publish our app.
Well, in my case we've cleared Google Play app cache and we didn't launch the Google Play before our app. You have to do it to download fresh data from the store, which is necessary for the SDK.

How do I determine the actual build number for Google Play Services on Android?

NOTE: I am not trying to update google play services in the emulator. I do not care that it is out of date. I mentioned it only to show that somehow logcat is reporting the actual build number, which I wish to access in the app.
Similar, but not the same as, How can I determine the version of Google Play services?
An app I'm developing using Android Studio 1.2.2 is experiencing a problem if the latest Google Play Services is not installed on the device, yet GoogleApiAvailability is not reporting a problem and so the code instructing the user to update is never called. If I manually tell the users to update play services in the play store with a manual link to https://play.google.com/store/apps/details?id=com.google.android.gms&hl=en, there is an update available, and the app functions correctly after they install it.
However I am unable to find a way to determine that the user needs to update via application code or the gradle build file.
In the gradle file I've specified: compile 'com.google.android.gms:play-services:7.5.0' and this is the latest version as far as I know. Android Studio does not indicate that I should update this line to a newer version.
The SDK manager reports the play services I have installed is "rev 25", and no update is available.
When I test in an emulator, the code works correctly, and in logcat I see the message: "W/GooglePlayServicesUtil: Google Play services out of date. Requires 7571000 but found 6774470". This is normal for the emulator since they haven't released new images yet, but it provides an interesting clue.
Is there a way to get this build number reported in item 3 above, programatically? If so, I could compare against that rather than using the isgooglePlayServicesAvailable method of GoogleApiAvailability -- which I'm already using, but is reporting success on devices that need an update.
I've managed to do a little digging and answer my own question. The following code will do what I (and perhaps others) want.
PackageInfo pi = getPackageManager().getPackageInfo("com.google.android.gms", 0);
if (pi.versionCode < VERSION_YOU_WANT)
{
// instruct user to update
}
What I've done is wrap this in the required exception handler and run it if the API check reports SUCCESS. If the version is too low I call the getErrorDialog just like when the API check fails, with ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED instead of the returned SUCCESS value.
Doing this may require you to update your minimum SDK target. For example both my phone(5.0.1) and tablet(4.2.2) report success from the API check, and going to the play store does not show an update for either one; However, the installed build on the table is 7895032 while on the phone it's 7895438.
This function will tell the user to update the GooglePlaServices if an update is available. You can start the registration process, if this function returns true
private boolean checkPlayServices()
{
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS)
{
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode))
GooglePlayServicesUtil.getErrorDialog(resultCode, this, 9000).show();
else
{
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}

Google Leaderboard display broken in latest release? (Google Play Services 7.5.71)

I had been successfully using the following code to launch the Google Leaderboards display from my game:
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(googleApiClient,getString(R.string.leaderboard)),LEADERBOARD_REQUEST_CODE);
However, recently after updating including Google Play Services (and probably other google libraries), the leaderboard display no longer launches and instead I get the return code GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED in onActivityResult(), and in the logcat I see:
E/ClientUiFragAct(26401): Not signed in. To launch Client UI activities, you must be connected to the games service AND signed in.
even though when I attempt to launch the GUI, I check I am signed in by doing googleAPIClient.isConnected() which returns true.
So, on 2 separate devices, this functionality has stopped working on the same version of my app when the only relevant change I can think of has been updates to Google libraries (Google Play Services 7.5.71 1955121-036).
I have a third device on which it still works, with an older version of Google Play Services 6.7.76 (1745988-034).
I build using API level 22.
Curiously, a couple of other games (not mine) still have Google Leaderboard display working with version 7.5.71 installed.
I may be barking up the wrong tree with the Google Play Services version hypothesis.
Anyone else experienced this?
We solved the issue by removing the "setAccountName" call in the configuration of the GoogleApiClient.Builder.
Old code:
GoogleApiClient.Builder builder = new GoogleApiClient.Builder( this );
builder.addApi( Games.API );
builder.addScope( Games.SCOPE_GAMES );
builder.addConnectionCallbacks( this );
builder.addOnConnectionFailedListener( this );
builder.setAccountName( "some.account#gmail.com" );
builder.build();
New code:
GoogleApiClient.Builder builder = new GoogleApiClient.Builder( this );
builder.addApi( Games.API );
builder.addScope( Games.SCOPE_GAMES );
builder.addConnectionCallbacks( this );
builder.addOnConnectionFailedListener( this );
builder.build();
This has the drawback that the account chooser will be shown when signing in which is okay in our use case and maybe yours as well. At least the achievements screen can be opened again.

IabResult: Billing service unavailable on device. (response: 3:Billing Unavailable)

I'm trying to use In-App billing:
mIabHelper = new IabHelper(this, BILLING_KEY);
mIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
#Override
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
Log.d(TAG, "Problem setting up In-app Billing: " + result);
}
}
});
And getting the error:
Problem setting up In-app Billing: IabResult: Billing service unavailable on device. (response: 3:Billing Unavailable)
Why? Tried to clear cache of the Play Store, didn't work for me.
Well we can't help you without having much information.So instead I'll try to do a checklist for you in case you missed something:
Are you testing on an emulator?Billing services should be tested on devices,BUT if you
really have to test on the emulator,make sure the emulator has google play installed and set up.This is very important!
Did you set the correct permission in the manifest? (com.android.vending.BILLING)
If you are still testing the app,did you get a test app licence from the playstore, imported the level in your SDK ,set up your licence verification library? (you can follow along here: setting up
On your activity onActivityResult did you correctly handle the activity result?As seen on the example from google you should do it this way:
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
Log.i(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);
// Pass on the activity result to the helper for handling
if (!inappBillingHelper.handleActivityResult(requestCode, resultCode, data)) {
super.onActivityResult(requestCode, resultCode, data);
}
else {
Log.i(TAG, "onActivityResult handled by IABUtil.");
}
}
Also having more information could be useful, like if you are testing on the emulator or device, the device name, the android version etc...
This error indicates that you're connecting to the in-app billing service on your device, but that the service doesn't support IAB version 3. It may be that your device's version of Google Play only supports version 2 of IAB. What version of Google Play is running on your device?
Is your version of Google Play otherwise functional (e.g., can you open the Google Play store)? Sometimes, if the date on your device is off, or there is some other problem, Google Play itself can go South.
Finally, what's in your logcat output? It would be easier to provide assistance if you provided more detail.
I got that error when I installed the App BEFORE I registered everything and set Google Play store up. Once I set the Google Play Store account up, the error went away.
Wipe helped me. Strange error.
The documentation for version 2.0 of the billing was actually more helpful than 3.0 for this one even though I'm using version 3.0 of the billing.
Here's how 2.0 describes it Response Code 3:
Indicates that In-app Billing is not available because the API_VERSION
that you specified is not recognized by the Google Play application or
the user is ineligible for in-app billing (for example, the user
resides in a country that prohibits in-app purchases).
For me I had to setup a test Google account on my phone first before testing. I forgot that step. Once I did that fixed it for me...
Look for Server Response Codes here:
http://developer.android.com/google/play/billing/v2/billing_reference.html
http://developer.android.com/google/play/billing/billing_reference.html
I found a problem to fix, try root with ur LuckyPatcher, open config Toggles -> Disable billing.
I had exactly this error when I removed all Google accounts from phone (thus wipe fixes because after wipe you probably set up an account after phone rebooted).
After I added an account I did not see this error.
Related issue What are the possibilities to get this error code 3 in InApp purchase?.
Had the same problem.
My device was rooted and ROM'ed with an older version of Google Market which did not self-update.
You can verify your the Market/Play version by looking at it in the AppManager.
I actually decided to use another device, but I guess otherwise I would have to find a way to upgrade the Market/Play version.
I got this error from wiping the Google Play cache. You have to reopen the Google Play app and accept the terms before it is functional for IAB again.
This is because the account which is currently logged in the device is not registered in Google Developer Console.
TO resolve this problem,
1. Go to your Google Developer Consol
2. In Account Detail Tab, enter the email address(which is in device) in "Gmail accounts with testing access" and press the save button on the top.
Thats it.
In my case I've set a different value for serviceIntent.setPackage("com.android.vending"); from IabHelper. Make sure you leave it with this value
I had that same error and then noticed my phone was in Airplane Mode! Once connectivity was restored, I was good to go.
IabHelper.java
Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
It is an error if it is not possible to specify correctly the action and packageName to IInAppBillingService.aidl.
Have come up with the solution.
Try the below 3 steps:
Clear the cache of GooglePlay app and Google Play services app.
Remove IInAppBillingService.aidl file.
Copy the above file again from sdk folder and paste it to the aidl folder in my app.
This problem usually occurs when we copy the aidl file from one project to another project.

Categories

Resources