How to make one binary to suit both Sandbox and Production

If your Game Client can know the current environment and switch connection automatically from your Sandbox Game Server to your Production Game Server, you need only upload one binary to satisfy both Sandbox and Production environment. DeNA Greater China developer portal will modify conf.json(iOS) / init.xml (Android) for connecting sandbox or production environment.

 

What you only have to do is to let your game client know your game server’s URL (Sandbox or Production game server).

How to know current environment?

ngCore

Your can use Social.Common.Config.getServerEnvironment() to get current environment.

 

1
2
3
4
5
6
7
8
var gameServerURL;
if (Social.Common.Config.getServerEnvironment() == "production") {
       gameServerURL = "https://game.server.url/production";
}else if(Social.Common.Config.getServerEnvironment() == "sandbox") {
       gameServerURL = "https://game.server.url/sandbox";
}else{
       gameServerURL = "https://game.server.url/unknown";
}

 

iOS:

 

1
2
3
4
5
if ([MBGPlatform isProductionEnv]) {

    //Here is production
}else
    //Here is sandbox
}

 

Android:

 

1
2
3
4
5
if(serverMode == ServerMode.SANDBOX) {
    //Here is sandbox
} else if(serverMode == ServerMode.PRODUCTION) {
    //Here is production
}

PREVIOUS

How to Add a Leaderboard

NEXT

How to use Remote Notification