-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open application when device connected #27
base: master
Are you sure you want to change the base?
Conversation
Hey, there is a reason why this isn't implemented: Older versions of android give a popup which appears everytime the device is plugged in. You can use my other app in order to automatically play monkeyboard on powerup. https://github.com/freshollie/headunit-controller-android I won't be merging this for this case :) |
That's odd, I made a reply that has disappeared now.. So the issue I'm trying to solve is excatly that popup box. With a2bb10d I get this on the first connection of the radio. The tick box is remembered, and the permission is preserved between reboots: The only remaining issue is if the radio is left plugged in and the device rebooted, then I get the first dialog when opening the application. This is because the connection event never actually happens. My personal workaround for this is to unbind/bind the usb hub via a shell script, this then triggers the connection event, and the application automatically has USB permission. |
Ah, interesting. Seems with 8 they have actually made the tickbox do something? In android 6 the tickbox would not be remembered and the popup would appear every time the device was plugged in again. Notice I actually have a readme section on that permissions popup. The solution (for rooted devices) is to edit the underlying android system service to accept the popup every time. I'm wondering if the manifest can be made to only apply to devices over a given version? Because this fix would cause the same level of annoyance for anyone using < android 8. |
Sorry I don't see that section in the readme. I had a quick look to see if you can make manifests platform dependent, not found it yet. Are you able to test this merge on any older hardware to double check it's the case. I didn't fully read the two subtly different popups at first, but they operate for different things. All the offical android documentation I can find leads me to belive that USB_DEVICE_ATTACHED has always worked like this. |
Ah, very sorry getting mixed up with another project of mine, see the "Usage" section of here https://github.com/freshollie/usbgps4droid :) Yeah, I do understand that they are 2 different popups. What I was trying to say is that the first is supressable in rooted android 6.0 and the second is not. There is a bug in Android 6.0 which doesn't save the "remember this" tickbox when the device is disconnected. The problem with the popup is android 6 is that it also forces the app to open when "ok" is clicked which was annoying. Not sure what the options are here. I understand that for you usage you don't want the popup, but TBH no point in merging it with the main repo if it can't be optional. If it's something you need for your app then you now have the fix. |
Android is a messed up platform. For my use case I'll take advantage of the benefits of open source and simply roll my own APK. I don't see a way of making it optional without making two builds: one for older platforms, one for newer. |
It really is, I appreciate the effort though! I understand it seems counter intuitive not to accept fixes like this, but like you said I either create 2 builds with and without the USB manifest or I remove backwards compatibility for my own device :( |
Updated Manifest to open application when device is attached