Is it possible to detect the USB-debugging on android devices?

in my app i need a way to detect if the android-device runs in usbdebugging mode.

Is it possible? If yes, how?

  • How to retrieve onSaveInstanceState() bundle in onResume()?
  • How to properly highlight selected item on RecyclerView?
  • Meaning of top, ascent, baseline, descent, bottom, and leading in Android's FontMetrics
  • Android path to array - read the points on a path?
  • Socket EADDRINUSE (Address already in use)
  • Example of how to download JSON from server?
  • thanx in advance

    Related posts:

    Execute shell script in Gradle
    Service or Bound Service?
    How to detect if a mobile device is emulated by Google Chrome?
    Is it possible to cancel/stop a download started using DownloadManager?
    CursorAdapter vs ResourceCursorAdapter
    Java, HttpURLConnection and setting the content length
  • Replace Google Now gesture
  • Android Email Multiple Attachment issue on HTC Thunderbolt
  • Any Example showing how to login using Facebook SDK 4.0 in Android either by using own button or Facebook Button?
  • Using a SQLite database in Libgdx
  • How Picasso Actually Cache the Images
  • time picker showing time like 4:7 instead of 04:07
  • 2 Solutions collect form web for “Is it possible to detect the USB-debugging on android devices?”

    You can use the following to get whether or not the ADB is enabled.

    int adb = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
    

    If it is enabled, adb == 1, otherwise adb == 0.

    On my Android 2.3 device it is possible to detect the usb debugging mode by scanning the complete process list (ps -s) for the process /sbin/adbd.

    If this process is present USB debugging is enabled.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.