akshay jha
akshay jha

Reputation: 21

<uses permission> in android studio is not working / application is not asking for permission

I am trying to make an app which starts by asking permission and accesses the hotspot of any device and any android version with which the very first problem which is bothering me is that why is not working, i have tried it on two devices and both of the attempts were unsuccessful.Please can anyone help me out to point my mistake. I checked similar questions related to it and have tried correcting it too but still not working.. here is the xml code:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.akshay.turnonhotspot2">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>


</manifest>

Upvotes: 1

Views: 3604

Answers (2)

Artur Akhnoyan
Artur Akhnoyan

Reputation: 141

Permissions are asked when when you need user personal data such as contacts, storage(photo, video, file) and etc..

You don't need to ask permission for android.permission.INTERNET, android.permission.ACCESS_NETWORK_STATE, android.permission.ACCESS_WIFI_STATE, android.permission.CHANGE_WIFI_STATE

Upvotes: 0

Ferhat Erg&#252;n
Ferhat Erg&#252;n

Reputation: 135

It is changed since Android API 23. You also have to ask permissions at Runtime. Check this document

Upvotes: 2

Related Questions