Set offline status of user in background

Hi,

I want to send status of user to server when my game goes to background.Please give me suggestion how can i do it in proper way.currently i am sending a call to server but did not get any response when my game is in background.

this isn’t really a cocos2d-x question

In your AppDelegate.cpp there is a function:

void AppDelegate::applicationDidEnterBackground() {
    Director::getInstance()->stopAnimation();

    SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
}

Send your server the statuse here.

Hi thanks for your reply @hgokturk but there is a problem no response i receive of offline server call in client side.because we can not execute code in background.

i am looking for best solution of this problem.

Got it. Then i guess, you should try sending push notification to your client from server when app is in the background.

can we send push notification from client to server ? @hgokturk

If you use App42 for backend for example, yes you can.
App42
App42 Notification Service

Thanks @hgokturk