-1

I have added all the permissions in the manifest file. In Lollipop and all the application will ask for permissions during install the app, but when the application is installed in marshmallow the permission is not asking.

Manifest Permissions are

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
Hitesh Sahu
  • 41,955
  • 17
  • 205
  • 154
Maria
  • 1
  • 2
  • so are you getting any error when you run the app in the marshmallow device ? – Sagar Nayak Jun 16 '16 at 09:36
  • No i am not getting any error . But the first activity is splash screen and then the google map the map is not getting populated. None of the function is working.The permissions are need to added from the settings>app . I need to ask when install or run the application – Maria Jun 16 '16 at 10:09

1 Answers1

0

Firstly, you need to classify all these permissions. On Android M version, they are mainly divided to Normal permissions(Like ACCESS_NETWORK_STATE in your Manifest file) and Dangerous permissions(like ACCESS_FINE_LOCATION). For Normal ones you don't have to request them which are granted automatically without a user reminder on installation any more. What you only need to do is just adding them in Manifest!

However, Dangerous permissions are more complicated to handle. On app starts up or runs to corresponding feature, you MUST firstly check whether the permissions have been acquired by Context.checkSelfPermission(String permission). Call Context.requestPermissions(String[] permissions, int requestCode) to request by system dialog and get result onRequestPermissionsResult().

Good news is you can request a bunch of permissions by one API as app launches. Furthermore, Dangerous permissions are managed in several groups. For example, you only need to request for ACCESS_FINE_LOCATION and get ACCESS_COARSE_LOCATION permission as well.

Korneel
  • 1,487
  • 14
  • 40
shaomin
  • 1
  • 1