1

Hi i have plan to develop app similar to http://itunes.apple.com/app/download-meter-for-wi-fi-3g/id327227530?mt=8

Please suggest me, which api's i have to look into? Any tutorials avilable?

Thanks in advace.

rat
  • 356
  • 1
  • 3
  • 14

1 Answers1

1

You want to be looking into the UIProgressBar object, and the related delegate methods. When you open a NSURLConnection, you can retrieve the expected size of the thing you are downloading (this method will vary depending on where your data is coming from).

The NSURLConnection will download the object in chunks, calling the didReciveData method every time it receives a packet of bytes. Here you can calculate the percentage of the file downloaded (it will be decimal format, ie. 0.74/1.0) as you append the data and update the progress bar accordingly.

Check out the tutorial HERE

gabaum10
  • 3,769
  • 3
  • 48
  • 89
  • @Geoff Baum, Thanks for your answer and great tutorial, but in given app it calculates entire phones download count. Is it possible to get notified by such event? – rat Jan 14 '11 at 17:41
  • What do you mean "entire phones download count"? – gabaum10 Jan 14 '11 at 18:22
  • Check out the answer here:http://stackoverflow.com/questions/332276/managing-multiple-asynchronous-nsurlconnection-connections You need to keep track of the things above for multiple connections running... – gabaum10 Jan 14 '11 at 18:53
  • @geoff The Application he was referring to measures amount of data device transfers from and to the internet while surfing websites, youtube, other apps. He wants to accomplish the same !! I would be interested to know the answer myself. My understanding till I saw this app was only Carrier or the Device Settings would know the data usage, is there a way to get usage statistics ?? – 0x8badf00d Jan 14 '11 at 20:26
  • Hmmm... I am not sure about that. Didn't realize that's what he wanted to do. I am not sure if Apple will let you monitor traffic? I feel like that would be a security concern... – gabaum10 Jan 14 '11 at 20:36
  • I bought this App from AppStore this morning. Manual says "Does not require internet connection to get traffic usage stats(works even in Airplane Mode)because it gets information on traffic from the device, not a carrier" interesting !! – 0x8badf00d Jan 14 '11 at 20:48
  • Very, I would love to hear how they are doing that... So is it a resource monitor then? As opposed to a network monitor only? – gabaum10 Jan 14 '11 at 20:54
  • @MacDev, can you run that app with instruments. From that we can know what all api are using to achieve this. Sorry if it is a foolish idea. – rat Jan 15 '11 at 06:57
  • 1
    @rat Since it is not my app, No thats not possible!! – 0x8badf00d Jan 15 '11 at 19:13