java - Path requests must specify a user by using UserEnvironment -
i getting "path requests must specify user using userenvironment" error using
environment.getexternalstoragedirectory().getpath()
i traced code , found in java.io.environment there function produce error :
private static void throwifuserrequired() { if (suserrequired) { log.wtf(tag, "path requests must specify user using userenvironment", new throwable()); } }
i searched in web , found solution here
environment.setuserrequired(false);
but solution not working me because cannot access "setuserrequired" method of environment. compilation error. searched function in environment class , found :
/** {@hide} */ public static void setuserrequired(boolean userrequired) { suserrequired = userrequired; }
can me how can access external storage of phone? solution ? emergency. lot
you need use userenvironment , path user.
int userid = userhandle.myuserid(); scurrentuser = new userenvironment(userid);
this code stolen environment.java , code use initialize internal user.
Comments
Post a Comment