{"action":"closed","issue":{"url":"https://api.github.com/repos/NativeScript/android-runtime/issues/399","repository_url":"https://api.github.com/repos/NativeScript/android-runtime","labels_url":"https://api.github.com/repos/NativeScript/android-runtime/issues/399/labels{/name}","comments_url":"https://api.github.com/repos/NativeScript/android-runtime/issues/399/comments","events_url":"https://api.github.com/repos/NativeScript/android-runtime/issues/399/events","html_url":"https://github.com/NativeScript/android-runtime/issues/399","id":142889219,"number":399,"title":"NativeScript RequestPermission undefined","user":{"login":"enchev","id":5804953,"avatar_url":"https://avatars.githubusercontent.com/u/5804953?v=3","gravatar_id":"","url":"https://api.github.com/users/enchev","html_url":"https://github.com/enchev","followers_url":"https://api.github.com/users/enchev/followers","following_url":"https://api.github.com/users/enchev/following{/other_user}","gists_url":"https://api.github.com/users/enchev/gists{/gist_id}","starred_url":"https://api.github.com/users/enchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enchev/subscriptions","organizations_url":"https://api.github.com/users/enchev/orgs","repos_url":"https://api.github.com/users/enchev/repos","events_url":"https://api.github.com/users/enchev/events{/privacy}","received_events_url":"https://api.github.com/users/enchev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NativeScript/android-runtime/labels/T:Question","name":"T:Question","color":"eeeeee"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-03-23T07:52:34Z","updated_at":"2016-04-05T12:51:47Z","closed_at":"2016-04-05T12:51:47Z","body":"_From @mabelanski on March 23, 2016 7:11_\n\nHow i can do for use android.support.v4.app.ActivityCompat.requestPermissions or android.app.Activity.requestPermissions ? \r\nBecause it's always undefined \r\n\r\nI want to do this \r\n\r\n    var context = android.content.Context;\r\n    var wifi_service = application.android.context.getSystemService(context.WIFI_SERVICE);\r\n\r\n    wifi_service.setWifiEnabled(true);  \r\n    var rs = wifi_service.startScan();\r\n\r\n    console.log(android.support.v4.app.ActivityCompat.requestPermissions); // undefined\r\n    console.log(android.support.v4.content.ContextCompat.requestPermissions); // undefined\r\n    \r\n    application.android.registerBroadcastReceiver(\r\n      android.net.wifi.WifiManager.SCAN_RESULTS_AVAILABLE_ACTION,\r\n      function onReceiveCallback(context, intent) {      \r\n         var tp = wifi_service.getScanResults();\r\n         console.log(tp); // empty []\r\n         console.log(tp.size()); // 0\r\n      });\r\n\r\nbut array tp is always empty and i thing that because i need the right permission, and on android 6 we need to ask it \r\n\r\ni also add on manifestfile :\r\n\r\n    <uses-feature android:name=\"android.hardware.wifi\" />\r\n    <uses-feature android:name=\"android.hardware.location\" android:required=\"false\" />\r\n    <uses-feature android:name=\"android.hardware.location.network\" android:required=\"false\" />\r\n    <uses-feature android:name=\"android.hardware.location.gps\" android:required=\"false\" />\r\n\r\n    <uses-permission android:name=\"android.permission.INTERNET\" />\r\n    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />\r\n    <uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />\r\n    <uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\" />\r\n    <uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\" />\r\n    <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\r\n\t<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>\r\n    <uses-permission-sdk-23 android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />\r\n    \r\nalso add on C:...\\app\\App_Resources\\Android\\app.gradle :\r\n\r\n    dependencies {\r\n        compile \"com.android.support:support-v4:+\"\r\n        , compile \"com.android.support:appcompat-v7:+\"\r\n    }\r\n\r\nThanks \n\n_Copied from original issue: NativeScript/NativeScript#1828_"}}