Android Gamer

unread,
Apr 21, 2019, 1:46:27 PM4/21/19
to MIT App Inventor Forum
I’m using Taifun’s PubNub method. But I’m having a problem for exiting a chat session.

Taifun has a button that closes the app when a user wants to exit.

I want a button that takes the user back to the main menu.

I’m using vertical layouts as my screens so when user taps the exit button the chat screen vertical layout becomes invisible and rhe main menu vertical layout becomes visible. However, the user will still be logged into the chatroom.

Ow can I get a user to leave the chatroom without having to close the application altogether?

Taifun

unread,
Apr 21, 2019, 4:57:04 PM4/21/19
to MIT App Inventor Forum

what about removing the close application block from the btnExit event and adding blocks, so the chat screen vertical layout becomes invisible and rhe main menu vertical layout becomes visible?

Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Android Gamer

unread,
Apr 21, 2019, 7:53:02 PM4/21/19
to MIT App Inventor Forum
That’s what I’m doing now. But it doesn’t mean the user has exited the chatroom. If the person they were talking to sends a message then the websub.get will be activated and a message will be sent to the user, only they won’t see it. Normally this wouldn’t matter but I don’t want PubNub eventually charging me unnecessarily if my app becomes successful.

Taifun

unread,
Apr 22, 2019, 12:11:22 PM4/22/19
to MIT App Inventor Forum
there seems to be no other possibility
there is only publish, subscribe and history
you might want to ask in a PubNub forum

Taifun

Dean Artis

unread,
Apr 22, 2019, 5:34:28 PM4/22/19
to MIT App Inventor Forum
I've checked the forums but can't find an answer so I will create a variable "online". It will be blank when screen 10 is initializes. When I set the vertical arrangements for the chat screen it will change to "yes". Then I will put the entire subscribe procedure inside an if-then block. If online=yes then call procedure subscribe.

When user leaves the chat screen It set online to blank text block

Reply all
Reply to author
Forward
0 new messages