BluetoothChat | Bluetooth chat software based on Android Classic Bluetooth
kandi X-RAY | BluetoothChat Summary
kandi X-RAY | BluetoothChat Summary
Bluetooth chat software based on Android Classic Bluetooth currently only supports functions such as one-to-one real-time communication, file transfer, friend addition, friend grouping, friend online status update, etc. Message sending supports text, emoticons, etc.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize event listener
- Send a VISE message
- Pack a Vise file
- Writes data to the connection
- Unpack data
- Converts a byte array to an integer value
- Checks if the right command is the right command
- Assemble the packet
- Encode bytes
- Initialize the widget
- Set the friend data
- Runs the connect thread
- Initialize the GroupFriendList
- Main loop
- Handle a Bluetooth receive callback
- This method writes a bluetooth object into a parcel
- Convert hex string to string
- Decodes a byte array
- Assemble the send packet
- Initialize
- Helper method to support ChatView
- Get a child view
- Get group view
- SetOnItemClickListener
- The accept thread
- Initializes data dialog
BluetoothChat Key Features
BluetoothChat Examples and Code Snippets
Community Discussions
Trending Discussions on BluetoothChat
QUESTION
I have an activity where I would like to show a list of both paired and unpaired bluetooth devices. I don't want a button that just shows the list, but the list is shown directly. I'm following the example of the android guides https://github.com/googlesamples/android-BluetoothChat/blob/master/Application/src/main/java/com/example/android/bluetoothchat/DeviceListActivity.java but I can't understand why the unpaired devices don't appear in the list, while the already paired devices appear correctly in the list. This is my code
...ANSWER
Answered 2019-Jun-19 at 16:14Found a solution. You need to request location permission (ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION) at runtime
QUESTION
My app is working fine on api 23.
However in api lower than 19, when I try to open the app, it throws an error, although I don't have an image view in my mainlayout:
04-15 15:46:37.196 25249-25249/io.github.swarajsaaj.otpblogdemo E/AndroidRuntime: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{io.github.swarajsaaj.otpblogdemo/io.github.swarajsaaj.INFINITY.bluetoothchat.MainActivity}: android.view.InflateException: Binary XML file line #39: Error inflating class android.widget.ImageView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309) at android.app.ActivityThread.access$700(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5317) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #39: Error inflating class android.widget.ImageView at android.view.LayoutInflater.createView(LayoutInflater.java:619) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:666) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691) at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at io.github.swarajsaaj.INFINITY.bluetoothchat.BluetoothChatFragment.onCreateView(BluetoothChatFragment.java:354) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671) at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:619) at io.github.swarajsaaj.INFINITY.common.activities.SampleActivityBase.onStart(SampleActivityBase.java:40) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1181) at android.app.Activity.performStart(Activity.java:5336) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2227) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309) at android.app.ActivityThread.access$700(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5317) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417) at android.view.LayoutInflater.createView(LayoutInflater.java:593) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:666) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691) at android.view.LayoutInflater.rInflate(LayoutInflater.java:752) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.rInflate(LayoutInflater.java:760) at android.view.LayoutInflater.inflate(LayoutInflater.java:495) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at io.github.swarajsaaj.INFINITY.bluetoothchat.BluetoothChatFragment.onCreateView(BluetoothChatFragment.java:354) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2074) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671) at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:619) at io.github.swarajsaaj.INFINITY.common.activities.SampleActivityBase.onStart(SampleActivityBase.java:40) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1181) at android.app.Activity.performStart(Activity.java:5336) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2227) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309) at android.app.ActivityThread.access$700(ActivityThread.java:157) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5317) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at dalvik.system.NativeStart.main(Native Method) Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi-v4/ic_bluetooth.xml from drawable resource ID
0x7f020062 ...
ANSWER
Answered 2018-Apr-15 at 14:18I guess APIs below 19 do not support some of the XML that is in your file:
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: invalid drawable tag vector
QUESTION
I need some help for data transmission between Android Wear and Android phone. I found some tutorials and sample code, so I could make a framework. Much of my code is similar to the Android open source sample, https://github.com/googlesamples/android-BluetoothChat. But my question is, if devices are already paired, do I need them all? In other words, my Android Wear watch and Android phone are already paired, can data transfer be much simpler? Or do each application using Bluetooth need everything from above sample code? Anyone who has this kind of experience of knows useful samples, please help me!
Thank you in advance!
...ANSWER
Answered 2018-Jan-26 at 20:28If your devices are already paired you don't have to set up the Bluetooth connection yourself. You can simply use the Data Layer API to synchronize and send data between the wearable and the phone.
QUESTION
I am modifying an Android bluetooth sample program to realise the communication between my android phone and an ELM327 module through Bluetooth.
The application is build from the program using Android studio. The application works very well between two android phones.
However, when I run it in one of my android phone and try to communicate with ELM327 module, the input messages coming from ELM327 are broken and some time has very serious delay. Could you please explain why the different apperances happen? If you can help to rectify the program, it will be really appreciated.
Below is part of the sample code for this application:
BluetoothChat.java: Handler
...ANSWER
Answered 2017-Dec-07 at 23:39I missed adding "\r" at the end of each command message that I send from phone app to ELM327.
After adding "\r", I can receive correct feedback from ELM327.
QUESTION
I am working on the project on the android dev. the website for BluetoothChat and it seems to be sending messages correctly but not receiving them. In the past, I attempted to create another Bluetooth app and when connecting to a device I was prompted to confirm the connection and presented with a pin code. when working on the current app I am never given a prompt. However, it is not hitting any exceptions and messages seem to be sending. Here is my Thread class for managing a connection:
...ANSWER
Answered 2017-Nov-09 at 07:14I noticed that your Kotlin when
blocks aren't replicating the function from the Java code.
Kotlin:
QUESTION
I want to receive the remaining tank volume and the current mileage of my car by using OBD II.
Therefore I have bought an OBDII Bluetooth Adapter for my car. I am using the AndroidBluetoothChat for connecting to devices and establishing a connection, through I can send and receive information.
But when I try to connect to my OBD2 Adapter, I get: Unable to connect. The OBD2 Adapter is always discoverable and I can pair them normally. Why is that?
The next question is, once i have established a connection, how can I receive Informationen like speed, mileage etc.
I am still a beginner and gratefull for every hint.
...ANSWER
Answered 2017-Oct-10 at 16:04i'm in your same project :D I start with BluetoothChat for understand how use Bluetooth and all works fine.... At the beginning you can chat with your OBD by sending Pids in the EditText from BluetoothChat...
But remember that you need a \r (carriage return) after every commands that you send. For example if you need the RPM, send a string like "010c\r" and you get a response like 10c410cxx where xx is the value that you must divide by 4 for get the real RMP... See every pids and data transformation in this table...
REMEMBER that for work the ELM327 (your obd device) need that the car is ON half turn key or total or you don't get data but only error!
For the pids that you need (if your car support them) you can see all of them in the wikipedia page that i liked.
If you want an automatic dynamic comunication with obd you must change the comunication of the BluetoothChat with some Queue or ArrayList of commands and send them continuosly.....
REMEMBER that the ELM327 can manage one command each time....so send the first command and wait the response... and again send another command an wait response...and so on...
QUESTION
I´m trying to develop an App which can send an .APK file via Bluetooth to another device with an Insecure Rfcomm connection. I´m running self-coded apps on both devices. The apps are not the same but I can still set the UUID, Rfcomm Listener and so on, so the connection should work fine and because of the insecure rfcomm without any alert to accept the transfer. I´ve tried the BluetoothChat example from the Android developer page, but I´ve got problems with changing the code for my purposes. Can anyone give me some snippets of code or any link to an tutorial how to setup Apps for Bluetooth File transfer? Every useful stuff is welcome.
EDIT: You could say I´m trying to develop an app, which can "update" another app on another phone by Bluetooth.
Thanks
...ANSWER
Answered 2017-Aug-29 at 09:39This worked for me:
QUESTION
I want to send or forward the information to the next activity,practical- I have a Bluetooth Chat On which I receive message but on clicking a button the activity changes,I want to yet keep receiving the messages while on the new Activity Bluetooth Chat code
...ANSWER
Answered 2017-Jun-16 at 08:19When you received the message on on BluetoothChatService, Broadcast the received message using local broadcast , And receive the message on the Activity which you need using Broadcast receiver.
Reference: https://developer.android.com/reference/android/support/v4/content/LocalBroadcastManager.html
Example on Local broadcast implementation http://www.sanfoundry.com/java-android-program-demonstrate-local-broadcast-manager/
Hope it solves your problem .
QUESTION
I have created a bluetooth chat,I want to make changes as such that I want to perform an action if the
if(messageRecieved.equals("message required"){
//Action
}
I do not know which statement is the above mentioned messageRecieved
ref-:https://github.com/googlesamples/android-BluetoothChat/tree/master/Application/src/main/java/com/example/android/bluetoothchat
ANSWER
Answered 2017-Jun-11 at 18:58In BluetoothChatFragment.java
add your logic inside handleMessage(Message msg)
where the UI fragment receives the message from the service:-
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install BluetoothChat
You can use BluetoothChat like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the BluetoothChat component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page