GoogleApiClient and Drive.API error - android

I am trying to enable Saved Game in my Android game. However, I find that if I call
builder.addApi(Drive.API);
builder.addScope(Drive.SCOPE_APPFOLDER);
the "Select Account" dialog doesn't even shown at all, and I cannot therefore sign in.
Uncommenting both lines and everything works fine (sign in, leaderboard, achievement) except Save Game. Trying to get a Snapshot gives me the following error
01-11 23:30:14.549 18072-18488/? E/Evader﹕ Must include Drive.SCOPE_APPFOLDER to use snapshots!
java.lang.IllegalStateException: Must include Drive.SCOPE_APPFOLDER to use snapshots!
Is this deprecated? This is the method recommended on https://developers.google.com/games/services/android/savedgames
I am working with LibGDX and the BaseGameUtils if that's relevant

If the code you included in your question is accurate, the problem is in how you are calling the Builder class.
The client is constructed using a builder pattern, so you need to update the return value of the previous call when creating the builder instance, such as: (notice there is only one semi-colon).
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Games.API).addScope(Games.SCOPE_GAMES)
.addApi(Drive.API).addScope(Drive.SCOPE_APPFOLDER)
.build();

The problem wasn't with the code whatsoever. It was the phone(test device).
I tested on another device and it worked flawlessly.
I updated uninstalled Google Play Store and Google Play Services updates, and re-installed them, and everything worked.
TLDR - Test on multiple devices. I'm not exactly sure why that happened on my device for my game only, but after performing the above, everything works.
Thanks Clayton Wilkinson

Related

Amazon IAP Android onProductDataResponse always fails

I am trying to implement a simple subscription IAP on Android using the Amazon SDK. I adjusted their subscription sample app. The code is really simple.
Set <String>productSkus = new HashSet<String>();
productSkus.add("TLS_SKU_MONTHLY" );
productSkus.add( "TLS_SKU" );
PurchasingService.getProductData(productSkus);
But the response from onProductDataResponse() is always fail. I'm not sure why, I cannot find any examples etc to even know if my SKUs are right, in the sample app they looked more like package names than this, but these strings are what I entered on the 'in-app items' on the apps page on Amazon. The app has not been submitted yet, but I need to test and implement IAP before that. Any ideas? I cannot even find a simple tutorial walking through this, and as usual their docs are poor.
edit, noticed im getting these errors that dont even come up on google
Kiwi: DataAuthenticationKeyLoaderV3: Unable to load authentication Key
java.io.FileNotFoundException: AppstoreAuthenticationKey.pem
DATA_AUTH_KEY_LOAD_FAILURE: CERT_NOT_FOUND: null
com.amazon.a.a.o.b.a.a: DATA_AUTH_KEY_LOAD_FAILURE: CERT_NOT_FOUND: null
I'm wondering, is this because I am running on real Android and not an Amazon device like a fire tablet or tv stick?
You should add your own AppstoreAuthenticationKey.pem to the project assets folder. It is not (and should not be) delivered together with the sample.
Basically, you must do a few things:
Login to the Amazon developer console and create your application.
Go to the “Apk Files" tab to download AppstoreAuthenticationKey.pem.
Add this file to the project’s assets folder.
You can get the full instructions from Amazon.
As for devices, yes, you must use an Amazon device. But this should not be the reason why you are getting this exception.

Firebase push notification - Default FirebaseApp is not initialized in this process

I am struggling to implement Google's Firebase push notifications in a mature MVVMcross application. We are being forced to seek a new solution to our current one because it appears that the functionality is about to be deprecated in AppCenter.
We've placed the code inside the RootActivity file (at the bottom of the method)
protected override void OnCreate(Bundle bundle)
When I run the app in a USB/debug scenario on my Android Galaxy I get the current error "Default FirebaseApp is not initialized in this process"
I tried to use the approach that was recommended in the error message to no avail:
FirebaseApp.InitializeApp(RootActivity.Context);
FirebaseMessaging.Instance.GetToken().AddOnCompleteListener(new OnCompleteListener());
In case anyone is wondering here is the code for the method that is mentioned above was setup for testing purposes using a breakpoint:
public class OnCompleteListener : Java.Lang.Object, IOnCompleteListener
{
public void OnComplete(Android.Gms.Tasks.Task task)
{
var token = task.Result.ToString();
}
}
We initially tested this in a standard Xamarin Forms Android app for testing and didn't have any problem with getting the token but we hit the wall when we played with it in our client's MVVMcross app.
I would also like to mention that I have tried the following solution with no luck as well:
var setupSingleton = MvxAndroidSetupSingleton.EnsureSingletonAvailable(Context);
setupSingleton.EnsureInitialized();
FirebaseMessaging.Instance.GetToken().AddOnCompleteListener(new OnCompleteListener());
I found that I had two problems. The first one was the fact that my project name did not match in my manifest and google services key. I was using my own key that I setup for testing. After I realized this I switched back to my client's key and double checked that it was part of the build. As soon as I resolved that issue I found that I needed to install the nuget package for Xamarin.Google.Dagger to resolve the reflection issues. After taking care of that I did a clean/rebuild and ran the debug on my Galaxy S20 test device. This fix allowed me to hit my test break point that I setup for testing the token reception from FCM.

Unable to see Dashboard of fabric

I have installed the fabric,integrated jar files and API key.I am always on "https://www.fabric.io/onboard" instead of " https://fabric.io/dashboard".Unable to see the crash report.I have used correct email Id.
Please help,Thanks in advance.
you can see the app here
https://fabric.io/home
and please wait some time to get updated .also double check in your app below line is enabled or not
Fabric.with(this, new Crashlytics());
also check these from the documentation
If you're getting started with Crashlytics for Android,
Make sure our SDK line is after all other 3rd-party SDKs Force a crash
and then relaunch the app. If you're using our
Crashlytics.getInstance().crash() method for testing purposes, make
sure it's not in the onCreate method of your launch Activity

Android Appinvite Error Unfortunately Google Play Services has stopped

I am trying to implement App invites in my app. Here's the java code that I am using :
Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.build();
startActivityForResult(intent, Constants.REQUEST_CODE_INVITE);
But, as soon as I am clicking on the button which executes this code, a dialog pops up saying 'Unfortunately, Google Play Services has stopped'.
I have tried disabling, uninstalling and installing google play services again, and even restarting the phone, but no use.
No Exception is shown in android studio logs, so I am not able to figure out the problem is.
Please help.
There are a few issues here, and I'd also you to validate values.
getString requires resources. Assuming you are calling this from in an activity, you need to call
getResources().getString(R.....). You are likely getting null
returned which would result in an exception.
Although there is only 1 required parameter, you should fill out a few more to make sure you have a reasonable invitation, specifically setMessage(). Also, you can use setAccount() if you know the account, otherwise it will prompt.
I would also validate the input values. For example, log the string value you get for R.string.invitation_title to make sure you have set this correctly before you call the builder.
I was making a silly mistake which was leading to the error.
I was not initializing the GoogleApiClient before sending out the intent. Don't know how I missed it.
Here's the code that I was missing :
GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(AppInvite.API)
.enableAutoManage(this, this)
.build();
Hope it helps future visitors to this page.

Android Google Plus Sign in - Internal Error toast

When I click on the Google+ login button I get a toast naming an "internal error". No error is logged. Also I'm using at the same time the google map api's with no problem, so I think the key value is correct. So what's the problem?
The PlusClient initialization:
mPlusClient = new PlusClient.Builder(this, this, this)
.setActions("http://schemas.google.com/AddActivity", "http://schemas.google.com/BuyActivity")
.setScopes("PLUS_LOGIN") // Space separated list of scopes
.build();
I have removed from the Google API Console the OAuth 2.0 Client corresponding to my app... And now it's working. I have no clue about the reason of this behaviour, because I have strictly followed the tutorial.
The scope you are using is wrong, try instead using:
https://www.googleapis.com/auth/plus.login
It looks like the documentation references the same scope as your example, which I believe instead should be a library constant (com.google.android.gms.common.Scopes.PLUS_LOGIN) that will ultimately resolve to the previously referenced scope.
I've removed key created with new api interface and created client id with old edit api interface. and now it works.
you must fill the "Consent Screen" under APIs ad Auths , nothing else works if you do not fill the content in "Consent Screen".

Categories

Resources