SDKBoxPlay disconnect in background

SDKBoxPlay disconnect in background



I am using Cocos2dx 3.17 and sdkbox iap ( and sdkboxplay (

I have tried the following versions
and the problem is the same. (
auth, ads, games, drive)

I have gone over the checklist multiple times

I have tested on both an older android 4.4.2 device and an android 7.1.1 device


When I call signin shortly after my game starts I can connect to google play. It always asks to choose account (this might be some other problem, I would like it to login without this), but I still login successfully.

I can then access the leaderboards successfully. But when I hit the home button (minimize the game) I get a onConnectionStatusChanged(1001). When bringing the app to the foreground, no other connection messages are given. I can then call signin (from a button in the game) which will successfully log me back in (again prompting me to choose an account). Any help would be appreciated resolving this issue.

Here is the logcat when I minimize

24344-24344/com.mycompany.mygame D/Cocos2dxActivity: onPause()
24344-24964/com.mycompany.mygame V/FA: Recording user engagement, ms: 136632
24344-24964/com.mycompany.mygame V/FA: Activity paused, time: 171376882
563-902/? I/MediaFocusControl:  AudioFocus  abandonAudioFocus() from$4205e760org.cocos2dx.lib.Cocos2dxAudioFocusManager$1$42192800
733-733/? V/KeyguardUpdateMonitor: handleSetGenerationId(g=130, clear=true)
24344-24344/com.mycompany.mygame D/AudioFocusManager: abandonAudioFocus succeed!
24344-24344/com.mycompany.mygame I/API: onPause()
24344-24390/com.mycompany.mygame D/cocos2d-x debug info: cocos_audioengine_focus_change: 0
24344-24390/com.mycompany.mygame D/cocos2d-x debug info: cocos_audioengine_focus_change : cocos_audioengine_focus_change: AudioEngineImpl isn't ready!
24344-24390/com.mycompany.mygame D/cocos2d-x debug info: Suspended
563-988/? V/WindowManager: rotationForOrientationLw(orient=-1, last=0); user=0  sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
563-656/? W/ContextImpl: Calling a method in the system process without a qualified user:$200:188$PolicyHandler.handleMessage:735 android.os.Handler.dispatchMessage:102 
884-884/? D/Launcher.Workspace: exitWidgetResizeMode State: NORMAL, newDragStarted: false
884-884/? D/Launcher: onRestart, Launcher: 1105926080
884-884/? D/Launcher: onStart, Launcher: 1105926080
884-884/? D/Launcher.HomeView: onStart
884-884/? D/Launcher: onResume, Launcher: 1105926080
884-884/? D/Launcher.HomeView: onResume
733-733/? D/PhoneStatusBar: setSemiTransparentMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
733-733/? D/PhoneStatusBar: setTransGradationMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
884-884/? D/MenuAppsGridFragment: onResume
1171-1171/? I/MultiWindowTrayService: mHomeResumeReceiver : onReceive
1171-1171/? I/Sally Service: removeWindow window
24775-24775/? V/TaskCloserActivity: TaskCloserActivity onReceive() -
24344-24964/com.mycompany.mygame D/dalvikvm: GC_FOR_ALLOC freed 2372K, 40% free 12551K/20732K, paused 68ms, total 68ms
24344-24344/com.mycompany.mygame D/Cocos2dxActivity: onWindowFocusChanged() hasFocus=false
563-24974/? W/ContextImpl: Calling a method in the system process without a qualified user:$ <bottom of call stack> <bottom of call stack> 
24344-24390/com.mycompany.mygame D/cocos2d-x debug info: PlayListener::onConnectionStatusChanged 1001
7404-7961/? W/GamesServiceBroker: Client connected with SDK 14536000, Services 14366000, and Games 70890030
24344-24390/com.mycompany.mygame D/cocos2d-x debug info: PlayListener::onConnectionStatusChanged 1001

Here is the logcat when I resume

733-733/? E/ViewRootImpl: sendUserActionEvent() mView == null
24344-24344/com.mycompany.mygame D/Cocos2dxActivity: onResume()
24344-24964/com.mycompany.mygame V/FA: Connecting to remote service
24344-24964/com.mycompany.mygame V/FA: Activity resumed, time: 171383900
563-804/? I/MediaFocusControl:  AudioFocus  requestAudioFocus() from$4205e760org.cocos2dx.lib.Cocos2dxAudioFocusManager$1$42192800
24344-24344/com.mycompany.mygame D/AudioFocusManager: requestAudioFocus succeed
733-733/? V/KeyguardUpdateMonitor: handleSetGenerationId(g=131, clear=true)
24344-24344/com.mycompany.mygame I/API: onResume()
143-143/? I/SurfaceFlinger: id=1099 createSurf (800x1280),1 flag=4, TurfaceView
143-143/? I/SurfaceFlinger: id=1100 createSurf (800x1280),1 flag=4, BppActivity
563-4866/? I/SpenGestureManager: setFocusWindow21025
24344-24344/com.mycompany.mygame D/Cocos2dxActivity: onWindowFocusChanged() hasFocus=true
24344-24390/com.mycompany.mygame D/EngineDataManager.cpp: setAnimationInterval by engine: 0.0083
24344-24390/com.mycompany.mygame D/EngineDataManager.cpp: JNI setAnimationInterval: 0.008333
24344-24460/com.mycompany.mygame W/libOpenSLES: Leaving Object::GetInterface (SL_RESULT_FEATURE_UNSUPPORTED)
563-24990/? W/ContextImpl: Calling a method in the system process without a qualified user:$ <bottom of call stack> <bottom of call stack> 
563-656/? W/ContextImpl: Calling a method in the system process without a qualified user:$200:188$PolicyHandler.handleMessage:735 android.os.Handler.dispatchMessage:102 
24344-24964/com.mycompany.mygame V/FA: Connection attempt already in progress
24344-24964/com.mycompany.mygame D/FA: Connected to remote service
24344-24964/com.mycompany.mygame V/FA: Processing queued up service tasks: 2


I’ve continued to try everything I can think of, still no luck. User is disconnected when minimizing the app. I even tried using SdkboxPlay from the example app and that didn’t work either.

Additionally, I’m trying to get cloud saves into the game. On iOS, it has worked with no problems, but on android I get the following in LogCat

E/SdkboxPlay: cloud save is disable

I have “Saved Games on” in the game services console.

Any help would be great.

  1. user is disconnected when minimizing app
    we will look inot this.

  2. cloud save is disable
    please enable cloud save in sdkbox_config.json

    "android": {
        "sdkboxplay": {
            "cloud_save": true


Thanks for your help, cloud saving is now working on Android. I would recommend updating the SdkboxPlay integration guide with this info, because I follow that when installing/updating plugins.

For your info, onSaveGameData is passing “success=false” on Android, even though it seems to be saving just fine (I’m able to sync two devices with my save data).

Also, thank you for continuing to investigate the problem of disconnecting google play in the background. I’d be happy to give any further information, should you need it.


the error string is empty?

how to reproduce this? every time is false?


Yes, the error string is empty and every time the function was called, success was false. But it must be saving, because I was able to sync 2 devices.

I’m not at work right now, so I can only give a general overview, but I know the steps are as follows:

Request the files
Wait for file name callback
If file exists, load the file
Wait for load callback
Merge data
Call save data
Wait for callback (on Android only, success claims false)

I can give more info in about 11 hours :grinning:

Here are the specific calls on Android

MyListener::onGameDataNames() > one name in list, example ""
MyListener::onLoadGameData() > savedGameData != null, data is good
MyListener::onLoadGameData() > savedGameData == null, error string is empty   // Not sure why this comes in, I ignore it
// Here I update some data
MyListener::onSaveGameData() > success==false, error string is empty (save is actually successful)

  1. success=false
    this is a bug, we fix it in next release.

  2. disconnect in background

please try this: (78.7 KB)


Thanks very much, this seems to be working great. I can minimize/resume with no connection loss. Plus, it has stopped asking to choose an account when starting the game (awesome). Cloud saving continues to work (the success=false issue won’t pose a problem until next release)

Will these fixes be in the next release? Can I use this jar file in production?

Thanks again.

  1. you can use this jar in production.
  2. this fixed will be in the next release.


We released the game…it is crashing 100% on some devices. 
  at (Unknown Source)
  at com.sdkbox.plugin.SdkboxGPGSavedGames.processSnapshotsClientTask (
  at com.sdkbox.plugin.SdkboxGPGSavedGames.access$400 (
  at com.sdkbox.plugin.SdkboxGPGSavedGames$8$1.onComplete (
  at (Unknown Source)
  at android.os.Handler.handleCallback (
  at android.os.Handler.dispatchMessage (
  at android.os.Looper.loop (
  at (
  at java.lang.reflect.Method.invoke (Native Method)
  at$ (
  at (

I tested it before release (uploading directly to a device) and I also got this crash. I decided to test it by downloading it from the play store and I didn’t get the crash. I would really appreciate some help solving this, the game is live now.


yes, we are research this. will fix in next release. thanks really…