views:

1561

answers:

3

I want to activate/enable GPRS on the iPhone programmatically. What are the APIs I can look into? There is no "Network" option in the settings application on the simulator so do I need to test out the application on the device itself?

+2  A: 

Using the SDK, you can't "activate" any sort of network access. Simply try to connect to the remote server.

If the device can connect, it will. If it cannot, you need to detect this and display a warning to the user.

Apple's sample code has plenty of examples on how to detect if a network is active.

August
+2  A: 

The Simulator always connects through the host Mac's internet connection. If you are asking how to test GPRS performance on the simulator then you should buy a USB GPRS radio and test rhrough that. You could also use the built in ipfw to throttle network bandwidth to the simulator and simulate GPRS bandwidth (note that latency would still be that of your hows connection). Throttled provides an easier UI than bare ipfw: http://www.intrarts.com/throttled.html

As August says, you can't switch the network on and off from code however, you can test the connection and suggest the user goes and switches on the connection.

There is good sample code from Apple for testing the connection availability and type: http://developer.apple.com/iphone/library/samplecode/Reachability/index.html

Roger Nolan
A: 

Hi is there any way to check wheather sound is off/on. if yes than how ? and if no than apple should have specified it some where that it is not possible to detect the sound on/off through programming. does anyone know about that. please reply at [email protected] Thanks

Naren