Closed edwin-pixel-1 closed 8 years ago
PubNub operates using a complex backend with caching of recently subscribed users and HTTP long polling. Messages are stored for a short amount of time so you will not miss anything if you transition between activities. Singleton isn't a bad idea for a messaging app where you should always be listening, but for AndroidRTC I was subscribing to different channels for different activities. Basically if I had a singleton, the procedure would be cancelling a HTTP request in unsubscribing from a channel and then reopening another for a different channel. I did the same thing allowing a slight overhead in recreating an object in exchange for channel manageability. I will make a singleton demo soon and let you know how it works.
Also since it is all polling, the "Logout" of pubnub is unsubscribing.
@Override
protected void onStop() {
super.onStop();
if(this.mPubNub!=null){
this.mPubNub.unsubscribeAll();
}
}
Hi, Currently I'm working in the prototype of my own app for Android. I would like use the PubNub services to do video streaming and calls, I just started to learn how PubNub API and their services works.
I have been checking the example about AndroidRTC , and I noticed that on every activity where PubNub Services is required, a new instance is created therefore a new login everytime. This is correct or this object should be in a singleton class? and How I can do logout of PubNub?
In advance, Thanks!!!!