I have developed two applications that use USB host. The second application mimics the functionality of the first, its just slightly different for testing purposes.
The first application works with USB perfectly, but the second one never asks the user for permission and therefore USB doesn't work. I've checked the manifests and I cant see a problem.
Surely two apps can use the same USB device independently?
Will post code if needed - thanks
Related
I was trying to enable USB debugging option on my Samsung Galaxy J1 Ace (SM-J110H) handset. As you already know that the screen is black/dead but except that the cellphone is working just fine. Somehow I managed to enable the USB debugging option by using an OTG cable and a USB keyboard(and off-course a lot of screenshots). But still unable to authorize USB debugging for my pc as I'm not able to click always allow from this computer.
So how do I allow/ authorize USB debugging from my pc? TIA
Ι would write it here as a comment, because answer is not based on facts, however on black screens I try to remember the basic buttons and can use some of my phones even blindfolded.
However when I was having a similar problem, I used a tool called ADB that made it possible to access some of my Lenovo A390's shell features via Windows CMD and managed to turn on USB-Debugging and even download some backup files from a password-holder app I used in that time.
https://www.androidphonesoft.com/resources/enable-usb-debugging-android-broken-screen.html
There was also a stack exchange topic that helped me run through the process.
https://android.stackexchange.com/questions/112040/how-to-enable-usb-debugging-in-android-if-forgotten-pattern-for-screen-unlock
Hope that helped.
Have two phones. The one with the dead screen and a working one. Download any app that can mirror an Android to another. Use the mouse to download it. Install it in the two phones. You can download apps like airdoid. Create account on the good phone, then login into the same account on both phones. U will be able to control the other phone with the working phone so that you accept the debugging prompt when it appears
I want to debug communication between two Android apps. I have Android Studio 3.0.1.
I don't understand how to start up two instances of the app.
Technically, DipendraSharma's answer is wrong.
You can't watch the logcat for two devices at the exact same time, since you can't have two active instances of logcat at once (there is a post about this somewhere, but I can't find it). However, you can launch the app on as many devices as you have available at once, and change between the devices tab in the logcat window. Just like you'd select multiple items in i.e. a directory, you pick the devices you want. Press CTRL (or the equivalent on a different keyboard) and press the devices you want. Example:
Then, like normal, press launch and after a short while of compiling and launching, it'll show up on both (or however many devices you picked). There is going to be a delay between the nth and the n+1th device in terms of launch.
Now, open logcat. You'll see this:
The dropdown with the device allows you to change the current device you're debugging and can see log info about. Change this as you need.
So yes, you can debug on multiple devices at once. This also applies to emulators. And they mix, so if you want to test on two emulators and two real devices, simply pick the ones you want and it'll launch on all the devices.
For emulators, you can debug as many at once as your computer allows you. For real devices, you can debug as many as you have USB ports for.
You can debug communication between two apps by:
1- Opening both Android Studio projects of course in two different windows.
2- Running each app on a separate device/emulator.
3- Attaching the debugger from each project to the relative app instance.
4- Set up break-points and debug!
Objective
I'm developing a custom app for internal use on a rooted android mini-pc.
The goal (between others... so...many...others...) is to be able to turn on and off a tv using the serial port embeeded on the tv.
I'm using an FTDI UART RS232 serial usb cable for it.
Status
The application is working right now, using an android library (serial-driver) i can communicate with the tv, but the problem is that the device asks for permissions every install (and sometimes, weirdly, again on the same device), so it needs to be improved.
Issue
Since the device doesn't have mouse or keyboard by default, when this happens someone has to click the buttons, and since the device is normally hidden behind the screen, it can be really annoying.
My two bits
This problem, i feel, can be solved by two methods, but i still haven't been able to make them work.
Since the device is rooted, i might be able to modify an unknown (to me) parameter that allows me to bypass the permission request. For this i have tried to make an intent filter for the usb device, and to rewrite the interface that controlls this behaviour, both without success. Is there a way to make this android version more lenient about permissions?
I use for other reasons SuperSU inside the app, so i can use the full width of the might shell power. Using this i've been trying to send commands manually to the device (/dev/bus/usb/00X/00Y), but this haven't worked. My theory is that it's beacuse of the permissions of the device path, but even doing an unhealthy chmod 777 i cannot have them working.
So, that's my problem right now. I hope someone here can help me.
Additional data
Running: Custom Android 4.4.2 (Cannot be changed)
Needs to be doable solely from within the apk (but it can use shell commands)
We don't have the manufacturer signature to install it as a system app
We can use only one app, so i cannot have another one to move this one to /sys/apps, and i don't know if an app can do that to itself.
using Busybox stty -F /dev/.../ returns "Operation not permitted"
I have a hobby android app idea that basically just uses Android's sensors and logs them long term for several days (external battery). The sensors needed are in $200 phones, and I can get ones for under $100 if the screen doesnt work.
My question is, is it pretty easy to make an app that starts and loads via debugging, keeps running when disconnected and when I connect I can extract the log file, or would this so be difficult I would be ahead just to spend the extra $100?
As mentioned, turning on USB debugging without the screen isn't possible. You can't enable USB debugging over USB for security reasons, so your only option would be to use hardware commands to put the device in firmware download mode (presumably it will have a way to do that), then load a custom OS which allows USB debugging by default.
Personally I think that's more than $100 worth of work, so I'd just go with the working device. Then you can use it for other stuff down the line.
Alternately, you can probably get a replacement screen for not too much, and for most devices changing the screen is relatively easy. I'd look into that option as well.
The first barrier you may find is that you must activate the Developer Options in the settings and the USB Debugging. And when you connect to the computer, you must accept that cumputer as the Debugger.
I don't know if it's possible to do it without a working screen.
App will keep running & yes you can can extract the log file when connecting again.
But the problem is in the first step. if your screen if not working, then how would you add your workstation as a trusted device in your "display not working device". I doubt if there is such way, because we need to do several things like switching on developer options, usb debugging etc.
I hope you got your answer.
We have recently bought ~20 different Android phones for testing (the emulators/online services just aren't good enough). When the phones are connected all at the same time the driver detects around half of them, but if I connect them one by one all are detected.
Is that a problem with the USB driver? Are there any alternative ways of doing this? I know that it is possible to run adb connect
[IP]:[PORT] but it seems like you need to root the phones for that.
I think you should be looking for a different means to get your apk onto your devices. I find myself testing on a similar number of devices, what I've gone to most recently is drop the apk inside dropbox and copy a link to it, then generate a QR that points to that link. Then I can just scan the QR with all of the devices I want it installed on. Bypasses the need for adb drivers too.
Yes , it's possbile, watch this url https://play.google.com/store/apps/details?id=com.tete.wifiadb