Network Activity Indicator

I’m using Backendless iOS API’s to query your DB service, API request gets triggered from many controllers and some time Util services, so its kind of not possible to update and remove the Network Activity Indicator. Does your API support any Notification that i can subscribe to add/remove the Network Activity Indicator? It would be great if you provide any other alternatives as well.
Thanks,
Arasan

Arasan,

No, it is not in our SDK, but it is available in the operating system:
https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html

Mark

Hi Mark -

Thanks for the quick response. I guess you are referring to the API that checks if the device can connect to the Internet and notify the user if its not connected. However, I’m referring to the network activity spinner displayed on the top of device when a HTTP request is initiated (see image attached). This spinner gets displayed when ever the below API is triggered.



[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

I run the backendless query using the below API (sample shown below). I need the activity spinner to be displayed when the request is fired and hidden when the request is completed.

let dataStore = backendless.data.of(MyClass.ofClass())      
dataStore.find(
	 // need to activate the Network Activity Spinner
     { (result: BackendlessCollection!) -> Void in
         for obj in MyClass {
             print("\(obj)")
         }
         // need to stop the Network Activity Spinner
     },
     error: { (fault: Fault!) -> Void in
     	// need to stop the Network Activity Spinner
      	print("Server reported an error: \(fault)")
})

Thanks,
Arasan

network_notification.png

Hi Arasan,

Please pardon my ignorance with that API. Just for my own education, if you were to call the following right before you make a Backendless API call:

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

and then disable it in both block-based callback (result and error), would it do what you’re trying to accomplish?

Mark

Hi Mark -

Yes, that would work. I have a bunch of request triggered from various places (TableViewController, Utils etc) and it would be hard to manage adding the network indicator and removing it once the request is complete. It would be nice to have backendless trigger a notification when a URL request is initiated and another notification when the URL request is complete. I can then subscribe to your notification and show/hide accordingly.

Arasan

Hi Arasan,

It might be possible, I’ll discuss with the dev team.

Regards,
Mark

Thank you Mark!

Hey Mark - Did you get a chance to discuss this with your developers?

BKNDLSS-12559 internal ticket is opened, please wait - we will let you know

Any update on this ticket?

Is there a way to track the ticket progress?

This feature is added, you should update the latest Bckendless SDK via CocoaPods (3.0.28 release) or from ios-SDK github (CommLibiOS and backendless).

To activate this feature you should call the method

[backendless networkActivityIndicatorOn:YES];
somewhere, for example, just after

[backendless initApp:...];

Hi Vyacheslav -

I updated my library to 3.0.28 but i dont see it working… Here is what i did…

  1. Updated my library to 3.0.28
Analyzing dependencies
Downloading dependencies
Installing Backendless-ios-SDK 3.0.28 (was 3.0.23)
  1. Updated my AppDelegate.swift as per your note.
        //initalize backendless
        backendless.initApp(APP_ID, secret:SECRET_KEY, version:VERSION_NUM)
        log.debug("backendless app initialized")
        blog.debug("backendless app initialized")
        
        //setup logger
        backendless.logging.setLogReportingPolicy(100, time: 60)
        
        //setup network activity monitor
        backendless.networkActivityIndicatorOn(true)
  1. Still don’t see the network indictor displayed when the backendless search is initiated.

Let me know if I’m missing anything here…

Maybe exchange time is short? I see a network indicator with my app.

Can you look at this project? https://drive.google.com/open?id=0B9g1UJkNKb8VVHpnNGp0SjBLNms

I have created one to replicate the issue…

This is true, in a short request/response cycle you cannot see a network activity indicator.

How many items do you have in your request? It would be nice if you can share the project (if possible). So, does the network indicator be visible only after reaching a threshold (some x amount of seconds or so?)

I don’t know. You could investigate it yourself.