Cocos Helper - Add Chartboost, AdMob, Google Play etc easily With Video Tutorials With Free Skype Assistance

For what platform?

C++ or JavaScript?

No you shouldnā€™t have to do anything.

But just go to Settings/Games Center and enable Sandbox under Developer

Let us know when you would like to do Skype.

C++ guys @SonarSystems

That was it! Ha, now I feel stupid. I didnā€™t know there was a setting to turn on sandbox.

Obviously, the simulators have it turned on by default. I just turned it on and it works beautifully on the device.

Thanks for all the help!

Hello,

I am new to coco2dx and also Cocoshelper

Currently my game AppActivity extends Cocos2dxActivity

I cannot extend SonarFrameworkActivity in my AppActivity as i need Cocos2dxActivity to run my game

Any idea how to i run SonarFrameworkActivity to make it work?

Btw iā€™m using android and implementing admob banner and interstitial

Please help me on this 1, very much appreciate for your help

=========================================================

package com.newrunninggame.test;

import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;

import android.os.Bundle;

public class NewRunningGame extends Cocos2dxActivity {

protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);    
}

public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);

    glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
    
    return glSurfaceView;
}

static {
    System.loadLibrary("cocos2dcpp");
}     

}

**

/******************************************************************
My Coco2dxActivity file
****************************************************************************/
package org.cocos2dx.lib;

import org.cocos2dx.lib.Cocos2dxHelper.Cocos2dxHelperListener;

import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.view.ViewGroup;
import android.util.Log;
import android.widget.FrameLayout;

public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelperListener {
// ===========================================================
// Constants
// ===========================================================

private static final String TAG = Cocos2dxActivity.class.getSimpleName();

// ===========================================================
// Fields
// ===========================================================

private Cocos2dxGLSurfaceView mGLSurfaceView;
private Cocos2dxHandler mHandler;
private static Context sContext = null;

public static Context getContext() {
    return sContext;
}

// ===========================================================
// Constructors
// ===========================================================

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    sContext = this;
    this.mHandler = new Cocos2dxHandler(this);

    this.init();

    Cocos2dxHelper.init(this, this);
}

// ===========================================================
// Getter & Setter
// ===========================================================

// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================

@Override
protected void onResume() {
    super.onResume();

    Cocos2dxHelper.onResume();
    this.mGLSurfaceView.onResume();
}

@Override
protected void onPause() {
    super.onPause();

    Cocos2dxHelper.onPause();
    this.mGLSurfaceView.onPause();
}

@Override
public void showDialog(final String pTitle, final String pMessage) {
    Message msg = new Message();
    msg.what = Cocos2dxHandler.HANDLER_SHOW_DIALOG;
    msg.obj = new Cocos2dxHandler.DialogMessage(pTitle, pMessage);
    this.mHandler.sendMessage(msg);
}

@Override
public void showEditTextDialog(final String pTitle, final String pContent, final int pInputMode, final int pInputFlag, final int pReturnType, final int pMaxLength) { 
    Message msg = new Message();
    msg.what = Cocos2dxHandler.HANDLER_SHOW_EDITBOX_DIALOG;
    msg.obj = new Cocos2dxHandler.EditBoxMessage(pTitle, pContent, pInputMode, pInputFlag, pReturnType, pMaxLength);
    this.mHandler.sendMessage(msg);
}

@Override
public void runOnGLThread(final Runnable pRunnable) {
    this.mGLSurfaceView.queueEvent(pRunnable);
}

// ===========================================================
// Methods
// ===========================================================
public void init() {
    
    // FrameLayout
    ViewGroup.LayoutParams framelayout_params =
        new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                                   ViewGroup.LayoutParams.FILL_PARENT);
    FrameLayout framelayout = new FrameLayout(this);
    framelayout.setLayoutParams(framelayout_params);

    // Cocos2dxEditText layout
    ViewGroup.LayoutParams edittext_layout_params =
        new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                                   ViewGroup.LayoutParams.WRAP_CONTENT);
    Cocos2dxEditText edittext = new Cocos2dxEditText(this);
    edittext.setLayoutParams(edittext_layout_params);

    // ...add to FrameLayout
    framelayout.addView(edittext);

    // Cocos2dxGLSurfaceView
    this.mGLSurfaceView = this.onCreateView();

    // ...add to FrameLayout
    framelayout.addView(this.mGLSurfaceView);

    // Switch to supported OpenGL (ARGB888) mode on emulator
    if (isAndroidEmulator())
       this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);

    this.mGLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());
    this.mGLSurfaceView.setCocos2dxEditText(edittext);

    // Set framelayout as the content view
    setContentView(framelayout);
}

public Cocos2dxGLSurfaceView onCreateView() {
    return new Cocos2dxGLSurfaceView(this);
}

private final static boolean isAndroidEmulator() {
String model = Build.MODEL;
Log.d(TAG, ā€œmodel=ā€ + model);
String product = Build.PRODUCT;
Log.d(TAG, ā€œproduct=ā€ + product);
boolean isEmulator = false;
if (product != null) {
isEmulator = product.equals(ā€œsdkā€) || product.contains(ā€œsdk") || product.contains("sdkā€);
}
Log.d(TAG, ā€œisEmulator=ā€ + isEmulator);
return isEmulator;
}

// ===========================================================
// Inner and Anonymous Classes
// ===========================================================

}

Great to hear

Try it on Cocos2d-x v3.7

Have you seen our video tutorials.

yeap i have seen it

The Cocos Helper videos?

Is there a way to see if a user successfully logged into Game Center? Likeā€¦ isLoggedIn() or something?

If not, do I just call the features I want and they get ignored if the user is not logged in? Like if I call

SonarCocosHelper::GameCenter::submitScore(score, "leaderboard_01");

will it just be ignored or will it throw an exception?

Huuh guys, you did awesome job by making helper.

But for us as developers now is hard choice ā€¦ SDKBOX, Cocos Helper, Soomlaā€¦

SDKBOX - looks easy to setup and officially supported by Cocos2d-x team, the only biggest issue is that it not supporting that much third party SDKā€™s.

SOOMLA - looks to huge to use just for in-app purchases and facebook.

Cocos Helper - just discovered it and looks promising. But again there is BIG BIG gap in functionality:

  1. Add In-App purchases - now we looking on SDKBOX we donā€™t want to mess our code with different ā€œenginesā€

  2. Why still everyone trying to integrate Google Play Services thru Java, please use C++ Google Play Services SDK , we already using it for year and it is c++, which is more suitable for Cocos2d-x c++ framework

  3. Mopub - if you added mopub, add mediation instructions, there is no need to create wrapper for each mopub supported network, just explain peoples how to set up it. (Like add official mopub wrapper to mopub sdk and add that framework jar/bundle files to project.

  4. From you Future plans focus on really useful and hard to implement for average developer part, I will higlihte what will make sense for ALL users:

Push Notifications
Local notifications (Android)
Cloud game save

So add missing point #1 and focus on #4 and you will became best choice for everyone, for now you just overlapping SDKBOX functionality and both products canā€™t be used as standalone as missing some functionality.

1 Like

Hi guys, I have a Suggestion:

Add more numbers for Advertsement IDā€™s. Then, we can select what ad we want to present.

Iā€™m using your Framework, but I had to modify it in order to use:

Admob Interstitial, 3 IDā€™s: 1 to Promote my other games, 2 to split the Earnings.
Admob Banner, 2 IDā€™s to split the Earnings

I think this is common for many developers.

Thanks for the great work.

1 Like

ATM there isnā€™t a method for checking is logged in.

It wonā€™t crash so you will be fine.

Thank you very much for your feedback, we pride ourselves on our video tutorials which make the process even easier for the Cocos Helper.

Those features are on our list.

Have you tried the Helper, as you will see it is the easiest choice.

Feel free to ask for help integrating it into your project.

Sounds interesting, we will take a look.

Hello, Does cocos helper support iOS facebook (login, graphā€¦) ?
From you videos, i only see android Facebook sdks setup guide, and github sources doesnā€™t include Facebook sdk

Thanks.

Not ATM but will in the future, it is also open source so anyone can contribute.

Hi guys,
Iā€™m having problems with the Game Centerā€¦
Iā€™ve a button(Show Leaderboard) and the code is basically this:

SonarCocosHelper::GameCenter::signIn(); SonarCocosHelper::GameCenter::submitScore(TheGame::Instance()->getScore()->getBestScore(),"IDLeaderboard"); SonarCocosHelper::GameCenter::showLeaderboard();

I expected that the game center login wold pop up if the player wasnā€™t signed on. And then after the login is completed the next like of the code, submit score would happen and then show leaderboard.
But it doesnā€™t do that. The login pops up and thatā€™s it.
Also, I can click the button many times and if the player is already logged on nothing happens. However, if I ask the player to login to game center earlier like on Main Menu as soon as the game is loaded, the score is submitted.
I noticed that this code in the IOSHelper.mm never becomes true if I try the above, all in on button click:

if ( [GKLocalPlayer localPlayer].authenticated )

Could you please help me out? Iā€™m trying to avoid to have to ask player to login to the game center earlier.

Something I noticed is that the facebook API is coming up with a blank post after I updated the facebook app on my iphone. It was working before, it was coming up with the text set in the code/callā€¦