Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. protected String RefreshMessages() {
  2. try {
  3. String line;
  4. String result = "";
  5. Process process = Runtime.getRuntime().exec("su");
  6. OutputStream stdin = process.getOutputStream();
  7. InputStream stdout = process.getInputStream();
  8. stdin.write("su -c 'sqlite3 "/data/data/<app>/databases/database.db" "" + REFRESH_QUERY + ""'n".getBytes());
  9. stdin.write("exitn".getBytes());
  10. stdin.flush();
  11. stdin.close();
  12. BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
  13. while((line = br.readLine()) != null){
  14. result = result + line;
  15. }
  16. Log.d("[Output]", result);
  17. br.close();
  18. process.waitFor();
  19. process.destroy();
  20. return result;
  21. } catch (Exception ex) {
  22. Log.d("ERR-RFRSH-MSG", ex.toString());
  23. return "0";
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement