How to control custom Android app via Bluetooth custom device - android

I'm building a Bluetooth device and would like to make it so that once it's paired with an Android device such as a phone or tablet (eg. Nexus 7) it will be able to interact with a custom app on the Android device in a transparent manner without any prior setup.
For example, the behavior I'm looking for is similar to that of a handsfree headset where once you've done the initial pairing you can push a button on your headset, issue a voice command, and it transmits commands to the phone and the phone does it's thing. I have built a Bluetooth device where when a button is pushed it should be able to immmediately send commands to a custom app on my Android device and the custom app should run and do its thing. This should all happen without putting the Android device into some ready state or having my custom app open waiting for commands; it should all be transparent without the user having to do anything (eg. the Android device could be in my pocket or bookbag).
I am a veteran programmer but very new to Android and Bluetooth and would appreciate pointers in the right direction. I imagine that perhaps I would need to install some service-level app on the Android device to implement my own custom profile and/or intercept the Bluetooth commands but these are just guesses; I'm hoping someone would shed light on the actual process so that I can read up on them in detail. I'm also hoping that the solution is a generic one that would apply across the board but right now I'll take anything I can get lol!
Many thanks in advance.

Related

Basic Android OS on low end smart watch to transfer information using Bluetooth

Is there a way to purchase a low end smart watch, replace the os with android (not Wear OS) and develop a custom app for it? It is a single purpose device, so I don't need any of the extras that come with Wear OS, but I need much longer battery life and ability to pair w/multiple phones (not simultaneous connection, but quick switching). I need to pair the phone using bluetooth, connect to it from an app (either Android or iOS), send an image/text, initiate a vibration, and send back an ack, with info. Ideally send heart rate as well.
I'm really not sure how to get started. I know how to develop apps in android studio and Wear OS as well, but it's taking me a long time to figure this out and I was hoping somebody might have done it before.
This seemed promising, but it wasn't the exact use case. It would even be great to test on some non smart watch android device or board.

Controlling Android app emulator with Mac's keyboard?

I'm trying to overcome a challenge of controlling my soundbar volume from my Mac. No volume sync alternatives are available, I tried them all so all the hope lays within this idea:
My soundbar volume can be controlled from an android/iOS app connected to the soundbar over wifi.
My plan is to have a android app simulator running and somehow bind volume keys to control the volume slider in the app. It sounds difficult so before I start trying I wanted to ask whether those things are at all possible:
Connecting the soundbar using app running on the android simulator via Wifi
Binding volume keys on my Mac to control the touch input of the android app emulator
If you have other ideas like using an actual phone and controlling its touch input I'm open to suggestion as I have some android phones laying around

Basics : Sending a signal from an external hardware connected via USB port to android phone to make custom app do stuff

I just need some initial directions as I am new when it comes to electronic hardware and android phone/app interaction. I am comfortable in both domains within their boundaries.
I have a black box electronic circuit. To simplify things lets assume all it does is, send binary 1 or 0 i.e. electric On or Off pulse. I need to connect this circuit to the android phone via USB(either Host/accessory mode) and want my android app to react to this pulse.
If possible - start the app when the phone receives 1/ON signal
OR display an "Switched ON" dialog message while the app is running in background as a service
Please dont worry too much about the electronics part. I'm aware that this is a software/programming forum.
e.g. black box : a electronic thermometer that sends a pulse/1/On signal if the temperature goes to 100 degrees Centigrade OR anything similar that's on a simple circuit board(no processor or programming language/architecture dependent) and could trigger a signal that could be sent to the android phone to inform my app that the event occurred.
another even simpler example, an earphone that has a connect/disconnect call button connected to audio jack of the android phone. i just need to replicate this functionality. instead or ear phone, my electronic BB and instead of phone call program, a custom android app.
Links, DIY projects, Tuts anything will be really helpful
This is a big open question. I'm guessing what you are asking for is a "real-world <=> Android" USB interface. This requires some hardware and some software. You may want to have a look here:
http://www.yoctopuce.com/EN/products/usb-sensors/yocto-knob
http://www.yoctopuce.com/EN/article/sample-applications-for-android
You may also want to have a look at the competition
www.phidgets.com
Be aware that making a USB device working with an Android device is not as straight forward as it sounds: you will need a Android device able to work in host mode, the Android image used in the device must support USB devices and you may have a power problem if the device is supposed to be powered from the USB port you are planning to use.
The experience shows that the cheapest an Android device is, the more unlikely it will work with exotic USB devices.

Bluetooth trackball and screen mirroring

I've very interested in a new project, but it requires the user be able to access the phone's display via a wireless trackpad and screen. I'm thinking bluetooth is the best way to go. I can find a few resources regarding the bluetooth classes, but I can't find any resources for mirroring the phone's display or manipulating the ui with a trackball using blue tooth.
Are these two things possible? Could someone give me some information or point me towards some resources?
So you want to remotely control your Android Device with a Trackpad using Bluetooth for the connection? Do you need this for the whole Android System or just for your App?
If just for your App, their should be a way of doing this since communication between two Bluetooth-Devices runs over Sockets (like Client-Server communication). See the Androids Bluetooth API. But I'm also not sure how you plan to make the Android Device understand the Bluetooth-Commands which the Trackpad is sending to it (if you can even get both of them to connect to each other).
If you need it for the whole System, I'm not sure if this is possible (without rooting the phone and maybe writing some drivers for it), as I don't know any way of emulating a touch/click on the screen (which is basically what you want).
Although I know that there are some experiments running to connect a Bluetooth-Keyboard with an Android Device. But their is nothing official yet and nothing to look into (like SourceCode) as far as I can tell.
But maybe I'm looking at this a lot too complicated...

Use Android device as a headset for another device

When I use Bluetooth on my computer, I have a choice of a few different types of devices to look for. One choice is "headset".
I want to make an application that will connect to another device as though it is nothing but a headset. So the audio and microphone will route from the Android phone to the other device.
Is this possible within the Bluetooth API? If so, is the Bluetooth Chat example the best thing to start with for something like this? Most of the information I can find deals with the opposite situation (using an actual headset with an Android device.)
Most phones are only bluetooth masters, cannot act as devices... I am afraid you are out of luck... Unless what you are doing is on a completely different device and in that case, no, the API will not handle that case.

Categories

Resources