This repository has been archived by the owner on May 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plan.txt
26 lines (14 loc) · 1.97 KB
/
plan.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Get host app to keep track of guests in a session
Get all apps to play a sound at the same time. (Can't do this on emulators)
Notes:
Handling host exits:
As of right now, I want have it so that if the host leaves the session in any way, the entire session will be shut down, users will be notified and their will be returned to the main screen.
If the host navigates away from the SessionActivity, onPause() will inevitably be called, so I have the host's onPause() destroy the entire session on Firebase. The other users each have a ValueEventListener that checks for the session to be null and will handle it in the way mentioned above.
The problem:
If the host device is in a session but has their device shut down improperly (battery disconnect, for example) onPause(), onStop() and onDestroy() will not be called at all! This means the device will be unable to destroy the session on Firebase, so the other devices will be unaware of the host's absence.
My solution (work around):
I need to have each of the users keep track of the users list for the session and see if the host leaves. If he/she does, they should destroy the session themselves, and then exit the SessionActivity. I'm not sure what will happen if multiple users try to destroy the same thing at the same time but I'd imagine it wouldn't be a problem. I need to make sure to destroy all listeners in my onPause().
NOPE. WONT WORK.
The users can't see when the host leaves!!!! I need to have a flag in the session that will serve the same purpose as the host telling the users that he has left. When they see it switched from 0 to 1, they'll know to shut down the session themselves. The flag will be raised by the onDisconnect() Firebase code I'm working on adding next.
I'M SO STUPID.
If I'm able to use the onDisconnect() method to set a flag to tell the devices to delete the session....why don't I just use that method to let the host destroy the session himself? What's wrong with me? Sometimes Michael...sometimes.