This document describes how to configure a Cocos2d project for the GME APIs for Cocos2d.
Note:The SDK supports compilation on macOS.
GMESDK
folder must be added to the project).Add gmesdk.jar
to the libs library.
Import the so
file into Activity
as shown below:
public class AppActivity extends Cocos2dxActivity {
static final String TAG = "AppActivity";
static OpensdkGameWrapper gameWrapper ;
static {
OpensdkGameWrapper.loadSdkLibrary();
}
}
Initialize in the oncreate
function exactly in the following sequence:
protected void onCreate(Bundle savedInstanceState) {
super.setEnableVirtualButton(false);
super.onCreate(savedInstanceState);
// Initialize exactly in the following sequence
gameWrapper = new OpensdkGameWrapper(this);
runOnGLThread(new Runnable() {
@Override
public void run() {
gameWrapper.initOpensdk();
}
});
}
Configure your project for compilation options by referring to the Android.mk
in the GME Demo for Cocos.
preBuild.mk
file: /Users/username/Downloads/GMECocos/GMESDK/android/bin/preBuild.mkProject configuration is required before you can export executables from the Cocos2d engine for different platforms:
Add the following permissions in the AndroidManifest.xml
file of the project:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
To use the voice messaging and speech-to-text feature, add the following under the application
node in the manifest file:
<application android:usesCleartextTraffic="true" >
Add the following permissions in the AndroidManifest.xml
file of the project as needed:
The read/write permission is not required. Determine whether to add it according to the following rules:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Add permissions:
Allow Arbitrary Loads
permission as shown below:You need to download the SDK for Windows as instructed in SDK Download Guide and import it into the project.
Was this page helpful?