How to get root access to my android application? -


i have application user take snap camera , view it.

for functionality, creating file in sd card store returned data camera created file

whenever creating directory getting error.

com.cyanogenmod.filemanager.console.insufficientpermissionsexception 

this code creating directory.

 public static file getoutputmediafile(int type) {          file mediastoragedir = new file(                 environment                         .getexternalstoragepublicdirectory(environment.directory_pictures),                 mediaconstants.base_directory);          if (!mediastoragedir.exists()) {             if (!mediastoragedir.mkdirs()) {                 //getting error here                 return null;             }         }        //code create file name in directory     } 

i got know application doesn't have sufficient permission create directory in external storage. please me on giving permissions application create directory

you don't need root permission this. rather, need appropriate file permissions:

 android.permission.read_external_storage  android.permission.write_external_storage 

you should add <uses-permission> declaration these in manifest. in addition, android m, should query these permissions @ runtime calling requestpermissions() , checkselfpermission() appropriate. see also: permissions , saving files documentation.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -