Android – clear app data programatically

        try {
            // clearing app data
            String packageName = context.getPackageName();
            Runtime runtime = Runtime.getRuntime();
            runtime.exec("pm clear " + packageName);
        } catch (Exception e) {
            e.printStackTrace();
        }