Support Topics Documentation Slack YouTube Blog

Real time disconnecting from service


(Mendelson Dalpakim) #1

Hello,

I’m trying to work with real time on android but I keep getting “V/FA: Inactivity, disconnecting from the service”
this is my code:
EventHandler<BackendlessUser> userEventHandler = Backendless.Data.of(BackendlessUser.class).rt();
userEventHandler.addUpdateListener(new AsyncCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser response) {
if(!response.getProperty(“filename”).toString().isEmpty()){
url = response.getProperty(“filename”).toString();
Log.e(“URL–>”,url);
}
}

@Override
public void handleFault(BackendlessFault fault) {
Log.e(“ErrorUpdate–>”,fault.getMessage());
}
});


(Oleg Vyalyh) #2

Hello.
I’ve created inner task to investigate the problem further.
[BKNDLSS-18047]


(Oleg Vyalyh) #3

Are you still experiencing this problem?
I tried with my app and your code example, all works fine.
By the way, i would recommend to check if the response.getProperty(“filename”) returns not null.


(Mendelson Dalpakim) #4

Changed to not null, still the same problem
adding a screen shot


(Oleg Vyalyh) #5

I’m talking not about response.getProperty("filename").toString() but about response.getProperty("filename")

And i also would recommend to remove all code inside handleResponse() and put there only one logging command, just to check whether the handler is invoked.


(Mendelson Dalpakim) #6

one logging command?
You mean log in to Backendless?


(Oleg Vyalyh) #7

No, i mean just logcat.


(Mendelson Dalpakim) #8

Same.


(Oleg Vyalyh) #9

if you put breakpoint on line 36, will it work?


(Mendelson Dalpakim) #10

The breakpoint didn’t do anything, but I figured something, the app response when I change something directly in the data base but not when I update through code from other device


(Oleg Vyalyh) #11

Ok, we’ll check this behaviour.


(Oleg Vyalyh) #12

I’ve tried with two devices. One of them was changing records in Users table, and another one listening to the changes in the same table. And all notifications were coming successfully.
Have you any other logic in your project that may influence on network work or maybe you have some other backendless api calls the app ?
Try to create totally clear app without any logic except one simple RT listener. Post here about your results, please.


(Mendelson Dalpakim) #13

I created a new app, tried a simple RT listener and still nothing,
I’m obviously doing something wrong I just don’t know what, I’m uploading the sample project so you can see
what is wrong
https://www.dropbox.com/s/hkpm849i5xczyls/RTTesting.zip?dl=0


(Oleg Vyalyh) #14

Hi.
I found a problem in your sample: TestActivity class, line 66.
Backendless.UserService.update

Try to use:
Backendless.Data.of(BackendlessUser.class).save
since you subscribe to listen to changes in Data service:
Backendless.Data.of(BackendlessUser.class).rt().addUpdateListener

Also pay attention to build.gradle. It looks a little bit strange, because of nested dependencies sections.