Adding Bluetooth Low Energy to android app with Kotlin - android

So, I've created an app and I want to be able to Add bluetooth devices to it (BLE or not). After I've added them, i want to display them in a different activity. I've looked for lots of tutorials(Stackoverflow and others) but couldnt find something specific.
I am a beginner and i used Kotlin to create the app.

Not exactly sure what you're looking for, but perhaps this SensorTag sample app is a simple enough example of what you're looking to accomplish?
It relies on Kotlin Coroutines to scan for nearby SensorTags, then allows you to select one, which navigates you to another Activity and connects to it, then displays sensor data.

I would like to recommend to use the rxJava for the BLE Scanning. For scanning the tags for forground and background working fine '
For view the demo on github rxAndroidBle_github_demo
on this library handled all exception.
I hope this will work for you !

Related

Bluetooth HFP support for Android App with SIP/VoIP

I am trying to add support for bluetooth devices like headsets/headphones/car stereo to my android app which allows user to make SIP/VoIP calls. I am trying to mostly address the requirements of Answering and Ending of calls using button on bluetooth headsets, other buttons/features handling is good to have.
With the search I have done and all the text I have read so far, I have come across the following-
One common way suggested everywhere is registering to ACTION_AUDIO_STATE_CHANGED. But this doesn't really helps me. Intents for it are sent every time the button on Bluetooth headset is pressed And also when we start the ring tone on bluetooth headset.
A very common solution I found was use of Bluetooth Adapter class. There isn't much you could do with it. So again not helpful.
Another approach I came across is the use of Vendor specific headset events. After some efforts I was able to get this working for specific Plantronics Bluetooth headsets. Supporting Jabra is important.
One more approach I came across is binding with IBluetoothHeadsetPhone.aidl, the way the phone app does it. I could find very little information on it, not enough to go ahead and implement any thing.
If anyone has done such things, I think the problem I am facing is not an uncommon one, I just believe it is not documented well.
Any pointer, approach, link would be appreciated.
I will try to add more info as I find any or any other approaches I try. Please ask for details if you need any more on the solutions I have tried. And please suggest changes instead of just flagging the question.
Thanks in adv.
Sorry about the late post. I was able to find a solution for this issue. It is not simple fix.
You need to use ConnectionService from Android telecom framework. Check out this link here & here. After this your VoIP calls will have cellular call like treatment.

How to built a Android Single App Mode

I want to use a Android Phone as a controlling unit for one of my projects.
In this the Smartphone is fixed on the hardware.
Tasks for the smartphone are:
Communication via Bluetooth
Handling User Input (e.g. PIN-Entry)
Turning on/off vibration, led ,...
So I wrote a App which does all the things I want.
Now I want that the Smartphone can only be used for this application.
Maybe you can give me some Ideas how to manage this.
I heard about 'kiosk-mode', could this be a solution.
Another option would be a custom ROM or is it possible to get a 'basic-android' without a launcher an just one single app.
I just want some ideas and usefull suggestions from you:)
If you are using Android version "L" there is a way to do that. It is called Task Locking, however it needs root access.
There is a lot of tutorials on this site. I just don't want to copy-paste it.
Take a look here: http://www.sureshjoshi.com/mobile/android-kiosk-mode-without-root/
Pretty good article about task locking and device ownership. And unlike Evgeniy said, root is not needed.

Send data from Arduino to Android

I'm trying to use an Android device to control an Arduino through Bluetooth. I able to control an LED and a few component at the Arduino. But I don't know how to have Android receive data from the Arduino similar to how the BlueTerm application works.
How can I do this? I don't want to use the Amarino library, because I don't want to have to use an extra .jar.
I suggest using a small library called Amarino. I have used it in the past and it provides a VERY simple interface for communicating from Android to Arduino and visa versa. It has a great deal of tutorials and you can even read the creators thesis to get a full understanding of how everything works behind the scenes.

Creating custom hardware Sensors in Android

I'm looking into creating custom sensors in Android and was wondering if anybody has attempted this. I was hoping there might be a way of creating custom sensors other than by using Android Open Accessory Development Kit.
For example, I manufacture a bespoke piece of hardware which has two water level readers built in. Is there any way of of exposing these to the Android OS via the SensorManager? Has anyone attempted this before? Essentially is there a way of adding custom Sensor items to the SensorManager.
Thanks a lot
I would say that it's not possible to modify the set of sensors provided by the sensor manager - it's a system service with a hard coded set of sensor types.
It would probably be best if you provided an Android service instead which provided these sensor readings which would then be available to any app which needed them.
This service would probably wrap the accessory devkit api to actually communicate with your device.
The service base class you would derive from would be this, which includes examples:
I have no experience on this, but I did some reading on similar topics recently.
I assume you already know about Arduino. I can give a link to a project where the author gets information from some external sensors and the control is done from an Android device. I consider that this project is similar to what you want to do.

Bluetooth remote control using android

I have an android tablet and have an application installed on it... Now i need to control this application on the tablet through my android device... is there a way to do such thing?
Explore this example project by Google
http://developer.android.com/resources/samples/BluetoothChat/index.html
see how it works and try to implement your programming skill to transform this chat application to your idea...
How ever I am assuming that you are the author of application which you have desire to control.
happy coding.
EDITED:
Logic structure is simple both application should be able to detect bluetooth and paired(connect) with each other for communication. once you have communication instead of sending message(in chat) you send some information via buttons which will execute some methods on tablet...Just a thought... As if in chat application you can update and add messages to your thread...this application will help you to reach goal. Lot of work though!
If you are familiar with Sockets, this shouldn't be a problem for you, because the Bluetooth-connection and communication in Android is very much the same. See the Bluetooth-Tutorial and Googles "Bluetooth-Chat" example.

Categories

Resources