We are testing several Lenovo Tab 4 Android (7.1.1) tablets as telnet clients over wireless LAN for part tracking (barcoding reading) in our manufacturing plant. Hopefully, these will soon replace very expensive Honeywell handheld computer/scanners that ride on every forklift. These handhelds have hardware keyboards, and the software they communicate with through telnet have no problems reading function key codes sent.
On the tablets we are using the Termius ssh/telnet client with the Hacker's Keyboard app, and it worked perfectly until last week. Suddenly the effect of tapping on a function key equaled the effect of tapping the ESC key, which basically causes the program to exit whatever form is active and return to the parent menu.
According to the settings for all related apps, the versions have not changed since everything was working, and there is no sign that any of the settings for the apps have been changed. We get the identical behavior on all tablets.
On one of the tablets, I have installed and tested several other (the most popular) ssh/telnet clients and do not have any problems with function keys. However, none of these alternatives provides a setting that allows "keep alives", or connection persistence, etc. that can keep the connection from timing out after 60s of inactivity. So that presents a completely new problem. Termius will stay connected all day if you like. We only need 5 min, and that's how it's configured. BUT, function keys don't work any more. So it comes down to "live with 60s timeouts" or "live with no function keys". Neither is acceptable.
PS: There were no changes to our barcode system server, or to LAN configuration, from the time the function keys worked until they didn't.
I'd appreciate any help or suggestions for next steps.
Related
I have a feature where I need to fetch current AND detect switch of the active audio output device of the system. Something like:
run app -> fetch current device (which might be embedded speakers)
connect bluetooth speaker -> detect switch to bluetooth speaker
connect audio jack -> detect switch from bluetooth speaker to audio jack
It seems to me there should be one API for this but it seems there are several. The one that makes the most sense seems to be MediaRouter but there are two large issues with it that prevent me from using it as described above:
There are at least 2 scenarios in which it fetches the wrong device as the active route and on other scenarios it straight up doesn't detect route switches at all. For details on this please check out the ticket I opened on the google issue tracker
I need certain information on the current active output device, most importantly a universal identifier. For bluetooth devices, the Complete Local Name can be used for this, which is available from BluetoothDevice types but this is not obtainable from the MediaRouter. Instead, MediaRouter makes a productName available, which sometimes can be an alias of the bluetooth devices, and not the static name.
I have since abandoned this API and moved on to find other solutions, let me know if anyone thinks there's a way around the problems above, most importantly the first one. I will note that I have used both the android.media.MediaRouter and the androidx one, they both have these issues.
I am now leveraging a combination of other APIs. It works but it is a far from acceptable solution:
Using AudioManager.registerAudioDeviceCallback(object : AudioDeviceCallback) for non-bluetooth devices detection (AudioDeviceInfo.TYPE_WIRED_HEADPHONES, AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)). I'm getting callbacks when any of these devices get added or removed and then I can check if a wired type device is present then that's the active one 100% of the time, if it's not, then the embedded-type is active. It's kind of hacky but it works.
More interestingly, for detection of Bluetooth output devices I use a private API, that Android itself uses in the Settings app to display the current audio output device.
BluetoothA2dp::class.java.getDeclaredMethod("getActiveDevice") to get the current active output device. This is done by getting the profile proxy service bluetoothAdapter.getProfileProxy
register a receiver for this action BluetoothA2dp::class.java.getField("ACTION_ACTIVE_DEVICE_CHANGED").get(null) in order to detect switches of the bluetooth active audio device.
This solution works but also has a few limitations:
they are obvious private APIs, subjected to sudden change and potential breaks
the active device APIs mentioned above are not available < Android 9. I have yet to investigate what Android is using pre-Android9 in the Settings app
On Samsung devices the active device API works incorrectly.
So, the million dollar question. How do I fetch and detect the current audio route on Android, reliably?
Our research lab has several pair of Google Glass that we've been using in our research. Recently, one pair (that had been sitting in storage) stopped working - we booted them up about a month ago (they hadn't been used since April 2014) and during the boot sequence, we received several "stopped unexpectedly" errors (for Home, Camera, and Voice functions).
We spoke with Google twice on the issue, and they told us:
(1) The Glass likely lost a connection during a software update, so to do a factory reset we'd need the original device that the Glass were tethered to to initiate a factory reset. Sadly, we no longer have this device, so we cannot initiate a factory reset.
(2) The Glass are out of warranty, so they will not offer any further customer service, other than to direct us to StackOverflow. (stings a bit, to be honest)
So, my question ... there has to be a way to manually reset the Glass via USB? Any help or advice from this community would be incredibly helpful!
You can do factory reset in Google Glass by doing this:
Tap the touchpad to activate Glass.
From the Home screen, swipe backward on the touchpad until you see the Settings bundle.
Tap into the Setting bundle and swipe forward until you see the Device Info card.
Tap again and swipe forward until you see Factory Reset.
Another method can be done using Recovery Mode.
To access Recovery Mode, turn off Glass. Hold the camera button, then press the power button once. Continue to hold the camera button for about 10 seconds, and Glass will go into Recovery Mode.
In Recovery Mode, you have the option to:
Reboot normally
Reboot into fast boot (This is mainly used by developers)
Factory reset (Removes your account, pictures, videos, and Glass settings from this device. If your Glass is having issues, this will give you a fresh start. Warning: If your pictures and videos haven’t been synced to Auto Backup, they will be erased. If you want to keep them, connect Glass to your computer using the USB cable and manually transfer the files.)
Sideline from adb (Also for developers)
Check also this thread for more information.
I had a similar issue with 2 pairs I have. I contacted Google support on this and they told me to power them on and leave them close to the last known WiFi access point they were connected to.
This has worked for 1 pair. The other pair still has the same issues. I'll update if I find anything that worked.
Good luck
I have a similar problem. Unfortunately, same boat ... device is out of warranty and turning the device on and update itself using the original Wifi or the paired phone is non-existent. Also seeking any way to refresh the "image" of the OS/program on the device via USB.
My app performs actions on a remote host via VPN. Everything works great: On a fresh phone I create the VPN manually and ensure it works, load the app up and run it to perform the remote action and go on with my day. My app also notifies me of things happening remotely, so the connection must be kept active for this to work. For now the app detects when the remote host is unreachable and sends a notification to inform me of the loss of connectivity so I can click on the reconnect button in Android's VPN status screen.
What I want is to programmatically "push" that button instead.
I'm not looking to add a new VPN connection with code, not even to start it with code -- I only want the VPN to be reconnected upon disconnection. Why doesn't Android support auto-reconnect, even if it were to only try a few times before giving up completely like the current implementation does.
The app will never be distributed, it's only for our in-house support staff, so I'm not concerned about backwards compatibility or device-specific problems as long as it works on the target device: Galaxy S III
At the moment, the app provides a shortcut to the connection intent for the user to quickly access the VPN screen using the SETTINGS intent:
public void openVPN(View view) {
startActivity(new Intent("android.net.vpn.SETTINGS"));
}
While this works for manually reconnecting, it's still annoying to have to do it and involves several taps to complete. I've searched everywhere and no one seems to have an elegant solution to this without rooting the phone and using a 3rd party VPN client package instead of the Android client.
Am I out of luck using the stock API or is there some secret ninja API that would have what I need, even if it means losing backward and forward compatibility?
This is my first question to Stack Overflow!
I was reading this
http://developer.android.com/guide/topics/wireless/bluetooth.html#QueryingPairedDevices
which is allot of help on how to pair,connect to a bluetooth device.
I have a situation where I have several BT devices that are in Non-Discover mode always. I know the MAC and the PIN of these devices. IS there a way in Android Dev to manually add devices to the PAIRED list so i can just use the connect as a client.
I understand this maual is written allot for V3. i think i will need to do this on 2.0 ; 2.1- has anybody done this before?
Basically these devices I want to connect to are power saving modules I used pre built BT modules to monitor daylight, another one humidity, etc.. every 3hrs or when interrupted and runs of a single battery for months. So turning off divcory on server saves immense power and prevents other people trying to connect and waste battery.
Not sure what you mean by "manually": Do you mean "manually" as in GUI/user interaction, or "manually" as "I do it in my own application code"?
Some suggestions though:
If you can make your BT devices discoverable at all, you could do it this way:
Make your BT device discoverable
Let Android search for and find the device and then initiate a connection
Android will ask for the PIN for pairing with the device; enter the PIN.
Once pairing was successful, Android stores the pairing information for future use, so that you can
Make your BT device invisible again.
From then on your app should be able to connect to the BT device at any time without further pairing operations.
If the said is not an option for you, maybe you want to go another way:
In current Android versions there are different API routines implemented which are neither documented nor exposed in the normal SDK. A hack kind of solution may be to use some of these "hidden" ("#hide"...) APIs, either via reflection or via modification of your SDK installation.
But be aware that this is always a hack and it may work on a specific device with a specific version of Android and is likely to break your app on another device and/or any other Android version.
Having said that, here comes some reference:
Example of how to access "hidden" bluetooth API.
Then, have a look at the source code for android.bluetooth.BluetoothDevice, e.g. here.
In there, public boolean createBond(){...} may do what you want.
I am struggling with an issue relating to the licensing service and network connection.
The bottom line is I want the LVL to work if the user is in the middle of nowhere with no signal, but I don't want them to be able to 'cheat' and turn off the data connection.
I already have detected and intercepted airplane mode, but some phones or apps let you turn data connection on or off. (some don't)
My Epic 4g allows this, and I think the hidden API letting us control this is not working past 2.0 release. (iTelephony)
However is it possible to simply detect if the connection was disabled and not change that fact but simply react to it?
I can already detect whether or not there is a data connection or not- what I want is to tell the difference between a disabled antenna and simply not having signal. The market licensing check will fail and I want to give 'em a pass if they legitimately have no signal, but not if they forced it off.
Well, I don't need to check whether net has been disabled outside of airplane mode,
I found a different solution here:
http://code.google.com/p/androidbest/
What this code does is force the user to authenticate at least once. Then if it fails to connect to the LVL server, it uses a cached authentication. I had to change it a bit, notably it was launching the next activity twice, and now it solves my issue adequately.