2017년 1월 3일 화요일

USB Debugging switch from App?


Is it possible to control from the App the USB debugging function (on/off)? I can activate it manually via Android settings... but I want to create a button in my app to control it.

--
Maybe it is not my business, but why would you want to do that?

--
see also this stackoverflow question http://stackoverflow.com/q/18782546/1545993

-- 


✱✱✱✱✱✱✱

If you use an Android phone and you’ve searched forums for solutions to problems, you’ve probably heard the term “USB Debugging” every once in a while. You may even have seen it while looking through your phone’s settings. It sounds like a high-tech option, but it really isn’t; it’s quite simple and useful.
One beauty of Android is that it has a lot of built-in features, many of which are advanced. If you want to supercharge your phone with mods and whatnot, you can; if you want to use it just as it was out of the box, you can ignore the advanced stuff. USB Debugging is a feature that all users can benefit from, though, so you should know what it does and when to use it.

What Is USB Debugging Mode?

USB Debugging Mode is a mode that can be enabled in Android after connecting the device directly to a computer with a USB cable. The primary function of this mode is to facilitate a connection between an Android device and a computer with Android SDK (software development kit). As the name might suggest, Android SDK is a software suite that’s designed to aid in the development of Android apps.
Ever wondered how a programmer creates apps on the Android? They definitely don’t code them straight on the phone device! That would be nightmarish at best. Instead, they utilize the environment of the Android SDK to code apps on a computer, use USB Debugging Mode to transfer those apps to a device for testing.
usb debugging
But, again, here’s the takeaway: USB Debugging Mode establishes a direct connection between an Android device and a computer and readies it for deeper-level actions. That’s the important part.

In some versions of Android, the USB Debugging Mode feature may be called Developer Mode. With such a name, it can be easy (and reasonable) to think that you’ll never need to deal with this aspect of Android if you never plan on developing anything. That’s not exactly true.

Why Is USB Debugging Mode Important?

USB Debugging grants you a level of access to your device. This level of access is important when you need system-level clearance, such as when coding a new app. However, there are a few non-development-related benefits from this new level of access that can give you much more freedom of control over your device.
For example, with Android SDK, you gain direct access to your phone through your computer and that allows you to do things you normally couldn’t, like snag instant screenshots of your device or run terminal commands with ADB. These terminal commands can help you restore a bricked phone–a useful tool for any adventurous Android owner. Without it, you’d have to get a replacement phone.6 Ways To Take Screenshots On Android 6 Ways To Take Screenshots On AndroidThis is how to take a screenshot on Android -- no matter what version you're running.READ MORE
android usb debugging

USB Debugging is also necessary if you ever want to root your Android device. Before an app like One-Click Root can dig into your system and deliver the exploit that roots the device, USB Debugging is necessary to allow that function in the first place.How To Root Your Android Phone With SuperOneClick How To Root Your Android Phone With SuperOneClickREAD MORE
Yes, the original intention for USB Debugging Mode was only meant for developers who needed to copy data between their computers and Android devices, to install apps on the phone without notifications, and to read log data off the phone. But even if you aren’t a developer, you’ll probably run into a few apps that require USB Debugging Mode to function properly, so this mode does affect you and you should know about it.

What You Need to Know About USB Debugging Mode

By this point, you may have noticed that USB Debugging isn’t used all too frequently. You’re right. This feature of Android isn’t something that you take advantage of on a daily basis unless you’re coding an app. However, when it does come in handy, it really saves you a lot of time, effort, and even money.
usb debugging
Therefore, it’s best to keep USB Debugging Mode disabled and only enable it when you really need it. When running an app, for example, it’ll let you know if it needs you to enable the mode before it can do anything. When that happens, you can enable it, let the app do its thing, then disable it again. Few apps will require your phone to constantly be in debugging mode.
Lastly, starting with Android 4.2, access to the USB Debugging Mode option has been hidden by default. I’m not entirely sure why the development team thought that move was necessary, but fortunately it’s not too much of a pain to get it visible again. Read How to Enable USB Debugging on Android 4.2 if you need to know how.

Conclusion

Just know that USB Debugging is not a super-high-tech feature that you need to be afraid of. Think of it as yet another tool that gives you full control over your device. This kind of power does invite abuse, though, so keep it disabled at all times and only enable it when you know you need it and you’ll be fine.
If you have any questions about USB Debugging, please ask in the comments. I’ll try my best to answer them.


댓글 없음:

댓글 쓰기