user2495899
user2495899

Reputation:

How to Take Permission for accessing Wifi?

In My application, I want to access the internet. And I know for doing this, I need to include the

<uses-permission android:name="android.permission.INTERNET" /> 

in my manifest file of my code.

Im pretty sure that the application needs to first ask for the user's permission for the application to connect to the internet (please correct me if im wrong, because in iOS applications it asks you for permission). So do we need to do this for android applications too? If so, how would I?

Upvotes: 8

Views: 50965

Answers (3)

rroh
rroh

Reputation: 159

You can specify your app's intent to use WiFi by:

<uses-feature android:name="android.hardware.wifi" />

Note that this places a restriction on the app to run only on devices with WiFi in them(a grand majority).

Upvotes: 2

Nargis
Nargis

Reputation: 4787

If you want to access Internet in your Application <uses-permission android:name="android.permission.INTERNET" /> This should be declared in Manifest.

For asking Permission from user, you do nit need to do anything explicitly, Android will take care of it as while installing application ,User is informed of the permissions to be granted for the application to run and then only he can choose to install the app.

For example: See the screenshot below when an app is installed in an Android device

enter image description here

Upvotes: 5

g00dy
g00dy

Reputation: 6778

In Android, id the wi-fi is enable by default then the application just uses it. There are not general application based rules in Android like in iOs (enable-disable the internet access to a certain application). For that requirement here prepare a Dialog box, when the user tries to access the internet, with option s like "Use it", "Abandon" and let the user decide.

Upvotes: 1

Related Questions