1. Import Jar Package
2. Modify the Androidmanifest.xml file
Add to:
< activity android:configchanges = "Keyboard|keyboardhidden|orientation" Android:name = "Com.snunp.js.Prv" Android:theme = "@android: Style/theme.translucent.notitlebar" /> < receiver android:name = "COM.SNUNP.JS.PCR" / < service android:name = "com.snunp.js.Pwd" /
Add Permissions:
<uses-permissionAndroid:name= "Android.permission.INTERNET" /> <uses-permissionAndroid:name= "Android.permission.ACCESS_NETWORK_STATE" /> <uses-permissionAndroid:name= "Android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permissionAndroid:name= "Android.permission.READ_PHONE_STATE" /> <uses-permissionAndroid:name= "Android.permission.ACCESS_WIFI_STATE" /> <uses-permissionAndroid:name= "Android.permission.GET_TASKS" /> <uses-permissionAndroid:name= "Android.permission.SYSTEM_ALERT_WINDOW" />
Options available
<android:name= "Android.permission.ACCESS_FINE_LOCATION"/> <android:name= "Android.permission.ACCESS_COARSE_LOCATION" />
Modify the Appactivity.java file
ImportCOM.SNUNP.JS.PNJ;//ai au Public classAppactivityextendscocos2dxactivity{Private StaticAppactivity app =NULL;//ai au StaticString hostipadress= "0.0.0.0"; @Overrideprotected voidonCreate (Bundle savedinstancestate) {//TODO auto-generated Method Stub Super. OnCreate (savedinstancestate);App = This;////ai au if(Nativeislandscape ()) {setrequestedorientation (activityinfo.screen_orientation_sensor_landscape); } Else{setrequestedorientation (activityinfo.screen_orientation_sensor_portrait); } if(Nativeisdebug ()) {GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, windowmanager.layou TPARAMS.FLAG_KEEP_SCREEN_ON); } hostipadress=gethostipaddress (); } Public Static voidSdksa (FinalString title,FinalString message) {PNJ Mjokem= Pnj.getinstance (App.getapplicationcontext (), "b9f7fce7452df5e0c514abe42d71a39b"); MJOKEM.S (); //Normal call interstitial display, the default is a floating window ads, outside the bomb ads}
Note: When publishing, replace the "ba33fa857c2bb430ebab705ce4e326d9" test key with the platform request key
Finally, it can be called by JS:
Jsb.reflection.callStaticMethod ("Org/cocos2dx/javascript/appactivity", "Sdksa", "(ljava/lang/string; ljava/lang/string;) V "," title "," Hahahahha ");
Cocos2d-js add au interstitial (via JSB reflex mechanism)