How to save chat history, using App Inventor 2 and PubNub ?

189 views
Skip to first unread message

Pavel Lunegov

unread,
Jan 6, 2017, 7:44:05 PM1/6/17
to MIT App Inventor Forum
At first, thanks for idea! Taifun is awesome=)
I`ve changed something in a blocks area for my personal look.Everything works but i still cant find info about saving the history of previous messages...For example, when i enter the chat and there is some discussions that i cant see..just my first visit and no idea about what they are talking about=) And one more question. After entering text in a text and sending, my message still appears in the text box. And when you want to enter a new text you must delete old message .. I want to fix it. Thank you .

Taifun

unread,
Jan 6, 2017, 9:38:00 PM1/6/17
to MIT App Inventor Forum
to get the history, see Q2 here https://puravidaapps.com/pubnub.php#q

After entering text in a text and sending, my message still appears in the text box. And when you want to enter a new text you must delete old message .
after sending, set textbox.text to empty string

Taifun

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

Pavel Lunegov

unread,
Jan 7, 2017, 7:49:21 AM1/7/17
to MIT App Inventor Forum
I saw that message, but i dont know how to change it...It seems like a code.. very familiar to html but i dont know where the code is located=(

Pavel Lunegov

unread,
Jan 7, 2017, 8:28:37 AM1/7/17
to MIT App Inventor Forum
" set textbox.text to empty string "  where is it? Can you show me te block? 

Taifun

unread,
Jan 7, 2017, 9:44:47 AM1/7/17
to MIT App Inventor Forum
A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn  App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

Taifun

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


Pavel Lunegov

unread,
Jan 7, 2017, 9:57:23 AM1/7/17
to MIT App Inventor Forum
Thanks, but your answer is not the answer i was expecting for....

Pavel Lunegov

unread,
Jan 7, 2017, 9:59:30 AM1/7/17
to MIT App Inventor Forum
I did not find info about Q2 and those strings,looking like a php or html.... how can i modify and add them to view a history of my chat?

Taifun

unread,
Jan 7, 2017, 10:37:47 AM1/7/17
to MIT App Inventor Forum
compare the documentation from PubNub with the App Inventor solution
for example 

To subscribe a message, issue a GET Request in the following format.

        http://pubsub.pubnub.com
        /subscribe
        /sub-key
        /channel
        /callback
        /timetoken
  


now do the same for history

  http://pubsub.pubnub.com
          /history
          /sub-key
          /channel
          /callback
          /limit


Taifun
PS: it helps to learn the basics first...

Pavel Lunegov

unread,
Jan 7, 2017, 4:09:36 PM1/7/17
to MIT App Inventor Forum
So..everything works fine.thank you! I still have problems with chat history. I only can get a list of messages via my PC browser using the :

http://pubsub.pubnub.com
          /history
          /sub-key
          /channel
          /callback
          /limit

Everything is ON in a Storage and Playback add-ons... Is it possible to see it on Android,not only via browser?

Pavel Lunegov

unread,
Jan 7, 2017, 4:28:13 PM1/7/17
to MIT App Inventor Forum
I think i am too stupid for that...I need chat history on my device,not only in a browser. Is it possible to do?

Taifun

unread,
Jan 7, 2017, 7:03:19 PM1/7/17
to MIT App Inventor Forum
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

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

Pavel Lunegov

unread,
Jan 7, 2017, 7:15:03 PM1/7/17
to MIT App Inventor Forum
Thanks for your response!!! I`ve made some changes,such as translations on russian and adding some CLICK melody when sending.... I just want to see the previous history ,every time i come in to chat... And it is a good idea to make sound notifications,when you recieve someting... Can you understand what i am talking about? I am writing without translators...i am russian=)
blocksproblem.png

Taifun

unread,
Jan 7, 2017, 7:23:13 PM1/7/17
to MIT App Inventor Forum
so where exactly is your new procedure to get the history following the subscribe example?
and where is the new WebHistory.GotText event to receive the history, assuming you added a new web component to get and receive the history?

it does not look like you added anything new to the existing example project...

again: first learn the basics...
Taifun

Pavel Lunegov

unread,
Jan 7, 2017, 7:33:14 PM1/7/17
to MIT App Inventor Forum
Yes, you absolutely right..Nothning Mega and Extra changed..Just the beginning... Your advise for learning is good and if i never tried to do something like that in APP inventor, i would never get success. It is a new step for me. Databases and Web elements. As you see i have API from PubNub and they work fine... Can you show me "how to" and thats gonna be the most powerful expirience for me...Thanks.

Pavel Lunegov

unread,
Jan 7, 2017, 7:43:49 PM1/7/17
to MIT App Inventor Forum
So i have to add Web event like you did (WebPub and WebSub) and call it WebHistory,for example... Than i must create a link to PubNub for calling the history...is it right? 
Message has been deleted

Pavel Lunegov

unread,
Jan 8, 2017, 10:23:53 AM1/8/17
to MIT App Inventor Forum
So... here is my first step...
webh1.png
webh2.png
Reply all
Reply to author
Forward
0 new messages