简体   繁体   中英

How to take User permissions in android without declaring it into manifest

I want Users READ_CONTACTS and ACCESS_NETWORK_STATE Permission For my app if i Declare this permission On Manifest my app gets Rejected by google play

Manifest file:  
  <uses-permission 
  android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.READ_CONTACTS"
     />

I am using This Code to get network info

 ConnectivityManager cm = (ConnectivityManager) context
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo();
    boolean networkState = activeNetworkInfo != null && activeNetworkInfo.isConnected();

if i remove the permission from manifest file "cm.getActiveNetworkInfo()" this shows error "you need to add permission on Manifest file"

Is Their any other way than manifest file to get the users permission Kindly help me on this.

It is not possible to request permissions without declaring them in the manifest.

Instead of focusing on removing the permission declarations in the manifest, focus on why Google Play has rejected the app and try to fix the issue.

According to official documentation you must declare permissions in manifest file. You are facing some other issues regarding app submission

Your manifest tells the device and the Play store about your app. You cannot try to skip that. If you really don't need those permissions then don't use it. Otherwise, make an appeal in your Play console if your app has been stopped.

Edit: Read this about Manifest and Google Android Developer Documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM