views:

273

answers:

3

does the code for checking network availability works well with 3g.(provided it works fine with wifi and 2g). Whether i should send the message to the destination and then show the error or first check for network availability.

A: 

I don't have experience from the iPhone, but in general detecting network presence is hard. It can change within a very short time since you last tested it, so any result from the test will still be unreliable.

I would suggest trying to send the data, if it's something you (or the user) want to send out anyway, there is no loss in trying. It's better to try, and get a failure from e.g. TCP (having done retries automatically as usual), than to decide at a single moment that sending is impossible.

unwind
A: 

I would suggest reading through this best practices guide, and then studying the Reachability example source code. That is the "apple prescribed" approach.

slf
yes it works fine for 2g and wifi. but for some reason (most of the time) its not working on 3g phones and i am unable to figure it out as to why it is behaving so.
pnandy
define "not working"
slf
A: 

thank you for your share.