private NgamesSdk ngamesSdk;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
// 初始化
ngamesSdk = NgamesSdk.getInstance(this, this, Const.LANG_EN);
}
public static NgamesSdk getInstance(Context context, Activity activity, String lang)
...
@Override
protected void onResume() {
super.onResume();
...
if (ngamesSdk != null) {
ngamesSdk.onResume();
}
}
...
@Override
protected void onDestroy() {
super.onDestroy();
...
if (ngamesSdk != null) {
ngamesSdk.onDestroy();
}
}
在主Activity#onConfigurationChanged中
...
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
...
if (ngamesSdk != null) {
ngamesSdk.onConfigurationChanged();
}
}
在主Activity#onActivityResult中
...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
...
if (ngamesSdk != null && ngamesSdk.handleActivityResult(requestCode, resultCode, data)) {
return;
}
if (requestCode == Const.THIRD_LOGIN_REQUEST_CODE) {
switch (resultCode) {
case Const.INTENT_RESULT_OK:
AccountResult loginUser = (AccountResult) data.getSerializableExtra(Const.LOGIN_USER);
//获取登录的用户信息
break;
case Const.INTENT_RESULT_CANCELED:
//登录取消
break;
case Const.INTENT_RESULT_ERROR:
//登录失败
break;
}
return;
}
...
super.onActivityResult(requestCode, resultCode, data);
}