Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:47:58+00:00 2026-06-12T04:47:58+00:00

Since Android Jelly Bean doesn’t support the logs reading permission (according to this google

  • 0

Since Android Jelly Bean doesn’t support the logs reading permission (according to this google io 2012 video and this one too ) , i would like to know if it’s possible for rooted devices (or non-rooted devices) to be able to bypass this restriction and be able to read the logs.

How do i do that? Do i really need to make the app a system app, or is rooting enough?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:47:59+00:00Added an answer on June 12, 2026 at 4:47 am

    You can obtain the permission on a rooted device by executing the pm grant command from your app. Probably you will have to restart the app after that for the change to take effect, though:

    String pname = getPackageName();
    String[] CMDLINE_GRANTPERMS = { "su", "-c", null };
    if (getPackageManager().checkPermission(android.Manifest.permission.READ_LOGS, pname) != 0) {
        Log.d(TAG, "we do not have the READ_LOGS permission!");
        if (android.os.Build.VERSION.SDK_INT >= 16) {
            Log.d(TAG, "Working around JellyBeans 'feature'...");
            try {
                // format the commandline parameter
                CMDLINE_GRANTPERMS[2] = String.format("pm grant %s android.permission.READ_LOGS", pname);
                java.lang.Process p = Runtime.getRuntime().exec(CMDLINE_GRANTPERMS);
                int res = p.waitFor();
                Log.d(TAG, "exec returned: " + res);
                if (res != 0)
                    throw new Exception("failed to become root");
            } catch (Exception e) {
                Log.d(TAG, "exec(): " + e);
                Toast.makeText(context, "Failed to obtain READ_LOGS permission", Toast.LENGTH_LONG).show();
            }
        }
    } else
        Log.d(TAG, "we have the READ_LOGS permission already!");
    

    This code should be called from your onCreate(). Once the permission is granted, no more root powers are required.

    P.S: The p.waitFor() blocks on the Superuser app, delaying your app start and potentially cause an ANR.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since android 2.3 Google has deleted - <uses-permission android:name=android.permission.MODIFY_PHONE_STATE /> http://code.google.com/p/android/issues/detail?id=54 But on Android
Ever since Froyo (Android 2.2), Google's Android OS has supported syncing Microsoft Exchange accounts
I had this question since android (seemingly) arbitrarily uses android2:... in some cases and
Google accounts come with a pretty nice profile already, and since all Android phones
I realize that this is not possible since Android doesnt have a JVM but
-webkit-device-pixel-ratio query is supported by both iOS and Android but since iOS does not
Since installing v17 of the android build tools I am getting a VerifyError in
Since the ActionBar is available only in Android 3.0 and later, what is a
I have installed Android SDK and packages. Since I had an error when opening
I am working on an application for android and we since we have lots

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.