Login Expired Monitor(required)
- To listen for login expiration events, you need to add a receiver with an action name of com.gd.session.action to the manifest.xml file, and then deal with the player's login expiration event in the BroadcastReceiver's onReceive() method. As follows:
- Add broadcast:
xml
<!—Register for expired broadcasts-->
<receiver android:name="com.gd.sdk.test.GameReceiver">
<intent-filter>
<action android:name="com.gd.session.action" />
</intent-filter>
</receiver>- Deal with events in the onReceive() method:
java
public class GameReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// handle with the player's login expired event.
// in general, go to the login page for players to re-login
if(intent.getAction().equalsIgnoreCase(GDSDK.SESSION_ID_ACTION)){
Intent i=new Intent(context, MainActivity.class);
i.putExtra("test", true);
context.startActivity(i);
}
}
}