I am researching my first attempt to write an android app. I basically just need a "dumb" app that runs on the device and looks for the Bluetooth pairing pop-up request and selects the "Pair" option.
I have found a lot of examples of this when the application I'd be writing is the one instantiating the pairing, but in this case, it's not - it's more of an "out-of-band" scenario. A device will initiate a pairing request with the phone & and app this "dumb" app would be running on. All I want to do is have this app detect when that happens and accept the pairing requests so I don't have to constantly do this manually.
I know there are automation frameworks that can do this, but that is such overkill for a what seems to be a simple task - just sit there and every # seconds (maybe 15) do a quick check for the pairing pop-up dialog and press pair
Is this possible?
Related
I created an application on the Raspberry (using QT bluetooth module) that publishes a service with a specific UUID and waits on a rfcomm socket. I was able from my Android application to pair with the Raspberry, to find the service and exchange data using sockets. The Android application simply asks to the user if he wants to pair with the Raspberry, without pin confirmation. Now I would like to add an authentication step, a simple pin or passkey, to allow the connection only to those who know it. I can change the Android application to show a dialog allowing the user to insert the pin, in such a way the application on Raspberry can verify the correctness of the pin and eventually close the socket, but this solution is obviously valid only for the devices with my application. Is there a way to implement a similar solution during the pairing process, in order to make it available to every devices? I tried among the QT functions but I didn't find anything that could help me. Thank you
There is a flaw in your design which is if you plan on authenticating with a pin the raspberry pi needs some way to tell the user what the pin should be. If you don't have a screen or output of some kind on the raspberry pi then the pin would be useless because you have no way to generate a random pin and then tell the user what it should be.
Depending on the application you are usually fine not having an authentication pin ect. Think about most Bluetooth devices you use, none of them have any authentication you can just click pair.
Here are some other options I can think of:
1) Detect when you have already connected to a device on the raspberry pi and not broadcast the service so once you are connected to a device another device cant also connect and cause issues.
2) Have a button on the raspberry pi and only broadcast the publish service for 1 min after pressing the button
3) get a screen or someway of outputting information to the user from the raspberry pi to show them the pin to enter on their phone
I am working on an application where we will have a BLE peripheral with a button, and an App running on an Android phone. The user will manually pair the peripheral with the phone, and then the phone may go into standby, or be used for other purposes.
Can a button press on the BLE peripheral cause the phone to wakeup and open the App?
On a related note, if the phone is power cycled, can it be configured to automatically re-pair with the peripheral, without requiring any user action?
If the peripheral is power cycled, can it automatically re-pair with the phone, without requiring any user action?
All the answers are YES , with some custom algorithms.
However I have to remind that in Android 4.3, connecting without user interaction is extremely dangerous. Android 4.3 cannot cancel any outgoing connection due to a bug, and no callbacks for connection time out. If the peripheral goes out of range/ runs out of battery / simply malfunctions during the connection, the Bluetooth stack of your phone will just STUCK until you reboot your phone.
If the connection is initiate by the user in the ui we can alert the user when it gets wrong, but if you start connection in the background automatically you may risk in breaking the Bluetooth without user understanding whats going on.
I have an Android Data collection App which collects sensors data. First, I enter the activity name in this app and then press the start button. After the recording is completed, I press the stop button and exit the app. For another activity, I restart the app again.
In my experiments, now I am using 5 smartphones on a participants's body while performing an activity so its bit difficult to start and stop this app for each activity manually as each activity is for 3-4 minutes and is a bit annoying.
I want to control this app remotely, either through another smartphone or PC. For example, like Airdroid:
http://airdroid.com/
However, Airdroid doesn't have the ability to start and stop (plus enter any data) at this point.
Is it possible to enter a name in this app, start it and stop it on multiple smartphones at the same time remotely ? May be using Bluetooth, local WIFI, or internet.
To summarize, I want to the following actions on an app remotely:
1) Start an App
2) Enter a name in its field (it can be worked around too so its optional)
3) Press start button
4) Press stop button when needed.
I looked it up online but most work has been done on controlling PC though smartphone and not the other way around.
Thanks
Zubkan
Integrate a HTTP server into your app, then you can control it easily using a web browser. A very nice option for Android is NanoHttpd, which comes as a java class.
Edit: Some additional notes:
This probably requires the phone to be connected via WiFi, because carriers might not allow this. And if the phone isn't rooted, you cannot run the server on Port 80, but Port 8000 or so will do.
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!
There is restaurant, and I have wrote app for them. Now my task is to create device communication: only single app (on a single device) should work at one time. I.e. when user starts to use application on one device, apps on other devices should show warning "Please, wait...". How I can do this?
I am thinking about creating lock-file on some server (maybe on dropbox open folder???). At start app should look to this folder and if the lock file is exists - wait. If there isn't lock file - app will create it, performs all users tasks, delete lock file, and closes.
Another idea - is to use bluetooth connection... Maybe at starting app should seek for bluetooth device with special name... if it isn't - open bluetooth communication with that lock-name and begin to work... But the problem is the device os 1.6.
I think you're on the right track, but maybe a little far down the development path to think of this now.
Anyway, create an exclusive lock that you expose in a webservice you've deployed on apache (obviously, that service will also expose an unlock method too).
Use a local wifi network (one you install in the restaurant) with a tiny linux box and you're in business.