CONNECTION_FAILED while creating room Google Play Services - java

This is my function to quickGame
Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(1, 1, 0);
RoomConfig.Builder rtmConfigBuilder = RoomConfig.builder(this);
rtmConfigBuilder.setMessageReceivedListener(this);
rtmConfigBuilder.setRoomStatusUpdateListener(this);
rtmConfigBuilder.setAutoMatchCriteria(autoMatchCriteria);
switchToScreen(R.id.screen_wait);
//keepScreenOn();
//resetGameVars();
getGamesClient().createRoom(rtmConfigBuilder.build());
and onRoomCreated where game stops
#Override
public void onRoomCreated(int statusCode, Room room) {
Log.d(TAG, "onRoomCreated(" + statusCode + ", " + room + ")");
if (statusCode != GamesClient.STATUS_OK) {
Log.e(TAG, "*** Error: onRoomCreated, status " + statusCode);
showGameError();
return;
}
showWaitingRoom(room);
}
Im getting statusCode = 7000 which is STATUS_REAL_TIME_CONNECTION_FAILED, and room = null so i think problem is in quickGame function.
D/Multiplayer(24221): Sign-in succeeded.
D/Multiplayer(24221): GameHelper: onActivityResult: req=10001, resp=RESULT_CANCELED
D/Multiplayer(24221): GameHelper: onActivityResult: request code not meant for us. Ignoring.
W/Multiplayer(24221): *** invitation inbox UI cancelled, 0
D/Multiplayer(24221): GameHelper: onActivityResult: req=10000, resp=RESULT_OK
D/Multiplayer(24221): GameHelper: onActivityResult: request code not meant for us. Ignoring.
D/Multiplayer(24221): Select players UI succeeded.
D/Multiplayer(24221): Invitee count: 1
D/Multiplayer(24221): Creating room...
D/Multiplayer(24221): Room created, waiting for it to be ready...
D/Multiplayer(24221): onRoomCreated(7000, null)
E/Multiplayer(24221): *** Error: onRoomCreated, status 7000
W/ResourceType(24221): getEntry failing because entryIndex 13 is beyond type entryCount 1
W/ResourceType(24221): Failure getting entry for 0x7f0b000d (t=10 e=13) in package 0 (error -2147483647)
E/GooglePlayServicesUtil(24221): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
W/PicturePileLayerContent(24221): Warning: painting PicturePile without content!
W/PicturePileLayerContent(24221): Warning: painting PicturePile without content!
W/PicturePileLayerContent(24221): Warning: painting PicturePile without content!
Im comparing my source code with google example, but no effects
I've Google Play Services 4.0 on tablet and latest sdk

Did you turn on multiplayer in the Google Play Developer Console?
Enabling multiplayer support
To integrate game services multiplayer support, such as player matchmaking, you must enable multiplayer settings. Currently, only real-time multiplayer for Android is supported.
To enable multiplayer:
Open the Games with Game Services page from the Google Play Developer Console, and select your game.
Open the Linked apps page for your game, then switch the multplayer setting to ON.
Click Save as draft to store your settings.
Source: https://developers.google.com/games/services/console/configuring#enabling_multiplayer_support

Just to let you know - i figured out what my problem is .. well sort of..
It turns out the problem is AdMob in my case - it was initially integrated as a separate library and when i added GooglePlus to the game started seeing lots of stuff in the console.
I was confused that the problem was GooglePlus (throwing the messages you are seeing about missing resources) - but it is the AdMob part that is doing that.
Nevertheless even after figuring this out GooglePlus operations do not function.
The strangest thing is that they work under an old HTC Sense (2.2) but not on any 4.x device..
I just ripped the whole thing out - lost two days in it .. for a single +1 BUTTON.

I installed google play services.apk from internet and that was the reason. I wait for update from Google Play and everything is working now :)

Related

Play Core in app update giving UPDATE_NOT_AVAILABLE on production release

I have integrated the play core in-app update it's working fine in the testing track but when a release is published in the production track it's always giving the UPDATE_NOT_AVAILABLE flag. I think the problem might be because Timed Publishing/Publishing Overview is enabled. Is there any fix or any setting which I have to change from the play console itself? or do I have to implement something in my android end?
here is the Implemented code-
AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
appUpdateInfoTask.addOnCompleteListener(listener -> {
if (listener.isSuccessful()) {
Log.d(TAG, "Update Available " + (listener.getResult().updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE)); // returns false
Log.d(TAG, "Update Allowed" + listener.getResult().isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)); // returns false
Log.d(TAG, "Update Availibility" + listener.getResult().updateAvailability()); // returns 1 that is UPDATE_NOT_AVAILABLE
if (listener.getResult().updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
&& listener.getResult().isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
try {
appUpdateManager.startUpdateFlowForResult(
listener.getResult(),
AppUpdateType.IMMEDIATE,
activity,
1001);
} catch (IntentSender.SendIntentException e) {
Log.e(TAG, "showPopup: ", e);
dialog.show();
}
} else {
Log.d(TAG, "no update: " + listener.getResult());
dialog.show();
}
} else {
Log.e(TAG, "no update: ", listener.getException());
}
});
I had a similar problem yesterday, and in my desperation put what should of been a comment about having a similar problem as an answer... #Natty showed me the error of my ways, and I felt bad, so made sure I'd come back with a better actual answer:
I discovered that the likely culprit is google play app signing. It looks like they changed things in August 2021 so as the default is to allow google to manage the app signing, which means your app is signed by a different key with each release, and thus your releases have different signatures, and it won't find the updates. The exceptions is internal app sharing.
Sadly, there appears to be no way to opt-out
You can't disable App Signing after being activated as you can read in the image below:
see this post
It get worse... because ya know google... your can't delete you app either, the only thing you can do is to
unpublish the app.
Then create a new version on the google play store. Change the applicationId to some slight variant so it counts as a different app.
When adding you first release for the new app in any track, make sure to select the appropriate option for app signing above where you drop in the app bundle
click use different key
Either use a keystore generated from android studio or make a new one. From then on google will use that same keystore for signing all future releases of the app.
I even went back and double checked this was the case for me, by checking the older version of the app and the new version on internal testing tracks. Indeed, the new version using the same app signing keystore works for in-app updates, but the older version with google app signing did not.
Just bear in mind a whole new app has to go through the review process, which can take 1-3 days for new apps (seemed to be much quicker once the initial review is done)

Interstitial Failed to load should i keep asking or?

I have a more of a tactics question
In my app i often get failed to load ad error code 3
My app is not banned , my admob account is fine i know that this error means that google has no ads to offer BUT
My question is what should i do after i get this error
1) Should i keep asking for ad with the code below? If i keep asking i finaly get an ad but shouldnt this will lead to app ban?
public void onAdFailedToLoad(int errorCode) {
// Code to be executed when an ad request fails.
mInterstitialAd.loadAd(new AdRequest.Builder().build());
}
2) Should i mediate with other networks?
3) Should i do nothing of the above and let my app mature and get more ads from google ?
4) is it true that according to the audience and app oldines google is providing more ads?
Thank you in advance
If you read mentioned post, you can see answers. Related Post
A1:
If you are getting this error, then your code is correct. The issue is
that AdMob does not always have an ad to return for every request.
A2:
Another reason your fill rate may be low is that you don't have
AdSense backfill enabled, or you have filtered out some ads. Check
your app settings to see if that is the case.
A3:
Questions 3 and 4 same. This is not about oldines or maturity.

Braintree + Google Pay got DEVELOPER_ERROR (statusCode=10)

We developing app for food ordering. In this case we implemented Braintree payment. All is well. The next step is to implement Google Pay (I pay your attention, NOT Android Pay).
I used this documentation:
Braintree Docs:
https://developers.braintreepayments.com/guides/pay-with-google/configuration/android/v2
Google PwG Docs:
https://developers.google.com/payments/setup
This how do we implemented Google Pay:
private GooglePaymentRequest getGooglePaymentRequest(String total) {
return new GooglePaymentRequest()
.transactionInfo(TransactionInfo.newBuilder()
.setTotalPrice(total)
.setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
.setCurrencyCode("AUD")
.build())
.emailRequired(false)
.shippingAddressRequired(false)
.phoneNumberRequired(false)
.allowPrepaidCards(true)
.billingAddressRequired(false);
}
And use:
String total = String.format(Locale.getDefault(), "%1$.2f", basket.total);
DropInRequest dropInRequest = new DropInRequest()
.clientToken(clientToken)
.amount(total)
.googlePaymentRequest(getGooglePaymentRequest(total))
.collectDeviceData(true);
getMvpView().showBraintreePaymentScreen(dropInRequest);
In this case we got two situations:
On my colleague's device all is working well (video: https://drive.google.com/open?id=1wEXbv8qzGXzuXWDUy7-bhIdud_4H_s2V)
On my side I got crash (video: https://drive.google.com/open?id=15gvtkNGZ9w6v1ym7cDkwWCnqHh5JUvL7)
After this I started debug and observed next situation:
As you see in Braintree's BaseActivity I got exception with statusCode=10 that means DEVELOPER_ERROR.
So is anyone have thoughs how it can be fixed?
I ran into the same error implementing Google Pay and I found the answer to my problem here:
https://developers.google.com/pay/api/android/support/troubleshooting
Quote:
The most common error message is ERROR_CODE_DEVELOPER_ERROR. This error message also appears in the UI as a dialog with the following text:
Request Failed
An unexpected error has occurred. Please try again later.
To learn more about this error, follow these steps:
Make sure ADB is installed on your computer.
Make sure USB debugging is enabled on your device.
Connect your phone to the computer using a USB cable.
Run the following command in a terminal or command prompt on your computer:
adb -d logcat -s WalletMerchantError
The response indicates the underlying reason for the error. For example, you may see:
02-26 17:41:28.133 14593 14593 W WalletMerchantError: Error in
loadPaymentData: This merchant profile does not have access to this
feature.
Note: The error only becomes visible in logcat after you've pressed OK to close the alert.
The action you need to take to resolve the issue depends on the error message.

Google Play Game Services Real Time Multiplayer Room Error STATUS_OPERATION_IN_FLIGHT

I have an application that uses the Google Play Game services real time multiplayer to automatch players. Creating a room is normally successful and the multiplayer will work correctly, except if the internet connection drops when trying to create a room.
If the internet drops while creating a room I get back a STATUS_REAL_TIME_CONNECTION_FAILED error in the RoomUpdateListener onRoomCreated(...).
My application is then stuck in the STATUS_OPERATION_IN_FLIGHT state when trying to create another room. I need to clear the application data to recover from this.
It seems like the failed original creation of the room put it into a bad state and won't allow the creation of another room. I don't see any way to cancel the room creation other than calling Games.RealTimeMultiplayer.leave(...) which requires a room id that I don't have since the room creation was never successful.
Here is how I am setting up my RoomConfig:
final Bundle autoMatchBundle = RoomConfig.createAutoMatchCriteria(1, 1, 0);
final RoomConfig.Builder roomConfigBuilder = RoomConfig.builder(roomUpdateListener);
roomConfigBuilder.setMessageReceivedListener(realTimeMessageReceivedListener);
roomConfigBuilder.setRoomStatusUpdateListener(roomStatusUpdateListener);
roomConfigBuilder.setAutoMatchCriteria(autoMatchBundle);
roomConfig = roomConfigBuilder.build();
Here is how I am creating a room:
Games.RealTimeMultiplayer.create(googleApiClient, roomConfig);
Solution: I reconnect the googleApiClient when getting in this state.
I do the following in my RoomUpdateListener onRoomConnected implementation:
#Override
public void onRoomCreated(final int statusCode, final Room room) {
if (statusCode != GamesClient.STATUS_OK) {
if (statusCode == GamesClient.STATUS_OPERATION_IN_FLIGHT) {
googleApiClient.reconnect();
}
// OMITTED ERROR CASE CODE
return;
}
// OMITTED SUCCESS CASE CODE
}
I am still not sure why it gets stuck in this state in the first place.
The documentation says that The lifetime of the current game's connection to the room is bound to this GoogleApiClient's lifecycle. So maybe you have to restart your GoogleApiClient

Google Play Game Services: strange sign in behavior

Recently I've added Google Play Game Services support in my app (added BaseGameActivity and GameHelper), and it sign-in and sign-out workflow worked fine. In my graphics thread I send message to main activity handler, it calls beginUserInitiatedSignIn or signOut. When identification process completes Game Helper calls onSignInFailed or onSignInSucceeded of my activity and I can check isSignedIn (true if onSignInSucceeded was called).
But today I've found that it behaves strange now. Sadly that I did not backup last working version, but the essense code is the same.
If I ask app to sign in it shows google services sign-in dialog (I have 2 accounts on my device). I choose an account, press ok, it returns to my app but neither onSignInSucceeded nor onSignInFailed is called (previously if I canceled this dialog I saw "unknown error" message). When I try to sign in in the second time it launches a rotating circle and waits endlessly. If I tap on screen it aborts waiting and returns to my view.
ALTHOUGH if I close the app and launch it once again, it signs in on launch successfully, call onSignSucceded and stay connected when I check in runtime. It says:
onCreate: creating GamesClient
onStart.
onStart: connecting clients.
Connecting GamesClient.
onConnected: connected! client=1
All clients now connected. Sign-in successful.
All requested clients connected. Sign-in succeeded!
If I sign out and then try to sign in again, it shows accounts dialog and writes:
isGooglePlayServicesAvailable returned 0
beginUserInitiatedSignIn: starting new sign-in flow.
Connecting GamesClient.
onConnectionFailed: result 4
onConnectionFailed: since user initiated sign-in, trying to resolve problem.
resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41f8a610: android.os.BinderProxy#41f8a5b0}}
result has resolution. Starting it.
When I choose an account it returns to my activity and neither onSignInSucceeded nor onSignInFailed is called. If I check in runtime I see that app is not connected to google services.
When I try to sign in again it shows forever rotating circle and says:
isGooglePlayServicesAvailable returned 0
beginUserInitiatedSignIn: continuing pending sign-in flow.
resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{41f8a610: android.os.BinderProxy#41f8a5b0}}
result has resolution. Starting it.
When I tap the screen, circle is aborted without calls to onSignInSucceeded nor onSignInFailed and so on.
I can't imagine what went wrong. Handler is created on main thread. I have Google example, and it signs in and signs out without any problem, just like my app did. Can somebody tell what can be wrong? Thanks!
It took 2 days to find a silly mistake. When you extend BaseGameActivity make sure you call all its methods in your activity methods (if you override them), for example:
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
....
<our code here>
}
BaseGameActivity calls its aggregated mHelper's methods which do all the magic.

Categories