HI I know similar questions such as this is asked before. The mentioned solutions aren't helpful.
Tried this `
File cache = getReactApplicationContext().getCacheDir(); File appDir = new File(cache.getParent()); if (appDir.exists()) { String[] test = cache.list(); Log.d("before", Arrays.toString(test)); for (String s : test) { //if (s.contains(".pdf") || s.contains(".mp4")) { deleteDir(new File(cache, s)); Log.i("TAG", "**************** File /data/data/APP_PACKAGE/" + s + " DELETED *******************"); // } } Log.d("After delete", Arrays.toString(cache.list())); } public static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); }
` but nothing happened
Tried this `
try{ if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT) { ((ActivityManager) getReactApplicationContext().getSystemService(ACTIVITY_SERVICE)).clearApplicationUserData(); // note: it has a return value! } else { String packageName = getCurrentActivity().getPackageName(); Runtime runtime = Runtime.getRuntime(); runtime.exec("pm clear " + packageName); } } catch(error){console.log("error"+error)}`
got warning in console Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. app is exited which is not encouraged. I need to show the login page after cleaning data.
Any Insights ???