06-05-2019 04:25 PM
public class MyReceiver extends BroadcastReceiver {
...
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.intent.action.ACTION_REQUEST_SHUTDOWN")) {
UnityPlayer.UnitySendMessage("YourGameManager", "Shutdown", "");
}
}
};
void Shutdown(string reason) {
// Save your game state
}