Google Play services integration fails with Cocos2d-x - android

I'm using latest Google Play services v4323030, downloaded BaseUtility library from GIT as written in google developer documentation.
In project using only GameHelper and GameHelperUtils classes without BaseGameActivity.
Initializing GameHelper in OnCreate method:
mHandler.postDelayed(new Runnable()
{
#Override
public void run()
{
if (!isGameCenterDisabled())
{
gameHelper = new GameHelper(Cocos2dxActivity.this,GameHelper.CLIENT_ALL);
GameHelperListener listener = new GameHelper.GameHelperListener() {
#Override
public void onSignInSucceeded() {
// handle sign-in succeess
}
#Override
public void onSignInFailed() {
// handle sign-in failure (e.g. show Sign In button)
}
};
gameHelper.setup(listener);
gameHelper.onStart(Cocos2dxActivity.this);
}
}
}, 3000);
Game is started and then it crashing:
Interface method not part of interface class
Could not find method com.google.android.gms.common.api.GoogleApiClient.isConnected, referenced from method com.google.example.games.basegameutils.GameHelper.getRequests
unable to resolve interface method 12116: Lcom/google/android/gms/common/api/GoogleApiClient;.isConnected ()Z
Cannot understand where can be trouble, why this methods is not visible...

Found out that during previous google play services update something gonna wrong, deleted and reinstalled then found out that current version is 4323000, modified manifest file to pick this version and everything looks works now.

Related

android snapchat login kit's LoginResultCallback doesn't work normally

I implemented the snapchat login in my Android app by referring to the snapchat login kit sdk guide.
I refer to the below code that uses a custom button.
// Get the login API
SnapLogin snapLogin = SnapLoginProvider.get(getContext());
View yourButtonView = findViewById(...);
yourButtonView.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// Start token grant
snapLogin.startTokenGrant(new LoginResultCallback() {
#Override
public void onStart() {
// Here you could update the UI to show login start
}
#Override
public void onSuccess(#NonNull String accessToken) {
// Here you could update the UI to show login success
}
#Override
public void onFailure(#NonNull LoginException exception) {
// Here you could update the UI to show login failure
}
});
}
});
Call startTokenGrant api to complete authentication in snapchat.
After authentication, callback is called when returning to my app.
Step 1 goes well.
But intermittently, the callback is not called.
I thought this was an error in the sdk, but I saw that it works normally in other apps.
Has anyone had an experience where the callback never gets called?
If yes, please help how to solve it.
(I'm developing using dev clientId right now, will this have any effect?)

Checkout Android Billing API getPurchaseHistory method question

Could you help to figure out what I'm doing wrong?
My goal is to obtain an Android subscription purchase history. To make this I using Android-checkout. So far the lib leverage was pretty straightforward. I managed to implement the purchase flow and access using
Inventory.Request
The next step in my business logic was to get a subscription history details.
Here is my code
Billing billing = new Billing(this, new Billing.DefaultConfiguration() {
#Override
public String getPublicKey() {
final Context applicationContext = getApplicationContext();
final Resources resources = applicationContext.getResources();
return resources.getString(R.string.google_play_key);
}
});
billing.connect()
billing.getRequests().isBillingSupported("<productId>")
isBillingSupported returns me BILLING_RESPONSE_RESULT_SERVICE_UNAVAILABLE (2)
when I try the following
billing.getRequests().getPurchases(<productId>,
null, new RequestListener<Purchases>() {
#Override
public void onSuccess(Purchases result) {
}
#Override
public void onError(int response, Exception e) {
}
});
The error callback method is returned and the error code is BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE (3)
Thanks in advance, probably it's worth getting switched to another library

How to add new Flurry Analytics in Android?

I have been trying to use Flurry Analytics with the official documentation but I am not getting it. As answered in the question here: How to use flurry in an application? I used
import com.flurry.android.FlurryAgent;
#Override
protected void onStart()
{
super.onStart();
FlurryAgent.onStartSession(this, "YOUR_API_KEY");
}
#Override
protected void onStop()
{
super.onStop();
FlurryAgent.onEndSession(this);
}
But the above code seems to be deprecated, the official documentation says to use
//If you are shipping an app, extend the Application class if you are not already doing so:
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// configure Flurry
FlurryAgent.setLogEnabled(false);
// init Flurry
FlurryAgent.init(this, MY_FLURRY_APIKEY);
}
}
What is meant by shipping an app?
How to integrate new Flurry analytics? Help me.
The previous versions of Flurry analytics required adding a line of code to each Activity in your app - in the onStart() and onStop() methods:
#Override
public void onStart() {
super.onStart();
// Start Flurry
FlurryAgent.onStartSession(this, );
}
#Override
public void onStop() {
// stop Flurry
FlurryAgent.onEndSession(this);
super.onStop();
}
The latest version of Flurry simplifies this by having you add a single line of code to the Application class of your app - so if you don't have an application class (and for most apps it is probably not needed) you will have to create one:
public class CKApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// configure flurry...
// init Flurry
FlurryAgent.init(this, MY_FLURRY_APIKEY);
}
</code>
"Shipping" and app means submitting it to Google Play store - or any other app store - in other words making your app available to the public is called "shipping the app".

Pinterest Android SDK / Callback after successful pin?

Fellow SO members,
I am trying to figure out how to get a callback from the Android Pinterest SDK, after a "pin it" event has successfully completed. I have implemented the SDK as follows:
PinIt pinIt = new PinIt();
pinIt.setUrl(socialContent.getLink());
pinIt.setImageUrl(socialContent.getPicture());
pinIt.setDescription(socialContent.getMessage());
pinIt.setListener(new PinItListener() {
#Override
public void onStart() {
super.onStart();
}
#Override
public void onComplete(boolean completed) {
super.onComplete(completed);
if (completed) {
handle Pin It form displayed=true event
}
}
#Override
public void onException(Exception e) {
super.onException(e);
exception handling code...
}
});
pinIt.doPinIt(getActivity());
Per the documentation, onComplete(true) gets called as soon as the Pin It form comes up. What I'm looking for is a way to get a callback when the "Pin It" event is successfully completed. So far, I have found now way to do this.
My iOS co-worker found that there was a way to register an app URI ("yourapp://blah") as a form of callback. I have found no such way to do this in the Android Pinterest SDK.
Does anyone know how to receive an event after the "Pin It" event is successfully completed?

Android license check using LVL - put your code inside the run() method or elsewhere

I am planning to use the Android License Verification Library (LVL) in my new paid app.
I am using the sample code provided in SDK. Do I need to move my code which is currently inside onCreate() method to this run() method:
private void displayResult(final String result) {
mHandler.post(new Runnable() {
public void run() {
***// Move code that was in onCreate() here????***
}
});
}
Thanks. Your help is greatly appreciated.
Take a look at this IO session on LVL http://www.google.com/events/io/2011/sessions/evading-pirates-and-stopping-vampires-using-license-verification-library-in-app-billing-and-app-engine.html

Categories

Resources