0

i noticed that the example for realtime multiplayer called "ButtonClicker" uses the same activity to do the game and the login activity. Is there a way to separate these activities? I would love to make the user login and join a room on one activity, but the game starts on other activity.

How can i do that?

I tried to create another BaseGameActivity and put all the information needed for sending and receiving unreliable message on a singleton(so the login activity can send these information to the game activity): user Id, room Id, ArrayList of the Participants and GoogleApiClient. But still, none of the players are executing the method onRealTimeMessageReceived().

What is wrong?

user2997681
  • 121
  • 1
  • 14

1 Answers1

1

The accepted answer here (from the Google guy who wrote the samples you are using) explains why the samples were written as single activities:

Google Play Game Services multiplayer with Activity switching

I rewrote my game services code as a set of fragments. Here is some information on a specific issue that I encountered, but some of the more general comments here may help you:

Calling Google Play Game Services from a fragment

I wrote part of my code as a headless fragment. Here is some information on that:

Google Play Game Services Multi-Player Device Orietation change kicks user out of room

So, in summary, separate fragments rather than separate activities is the route that I recommend.

Community
  • 1
  • 1
IanB
  • 3,489
  • 1
  • 20
  • 24