Reputation: 151
Is there any way to start the internet through Wifi/GPRS/EDGE/UMTS from application??
Thanks and Regards.
Upvotes: 1
Views: 391
Reputation: 5685
You don't "start" internet access from within your application. When a user runs your application there can be 2 cases:
Internet is not available
Internet is available. For most cases you don't need to care if its available through GPRS, 3G, wifi, etc. This can have another 2 cases:
a. Internet is available but for some reason it your requests are timing out.
b. Internet is available and everything works fine for you.
Your app should be able to handle all these cases and show UI to the user accordingly.
Upvotes: 0
Reputation: 6012
If you just want to launch a web browser with a URL use the following:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
Of course you need to add the INTERNET permission into your manifest as Rpond suggested:
<uses-permission android:name="android.permission.INTERNET" />
Upvotes: 1
Reputation: 3460
Basically, you can just assume there's an internet connection available, and use anything that would access the internet (socket, HttpClient, etc). You just need to include error handling in case the device can't get a connection for whatever reason.
Upvotes: 1
Reputation: 73494
This is a vague question. You can use a WebView to hit a url, or use the built-in Apache HttpClient classes to make any kind of HTTP request. You just need to have the INTERNET permission. And also you can use Intents if you want to launch the browser to view a certain URI.
Upvotes: 0