getBluetoothService called with no BluetoothManagerCallback - android

I am getting getBluetoothService() called with no BluetoothManagerCallback as an error frequently in my Android application.
I have no idea what is causing this or anything about bluetooth manager callbacks. Can anyone give me a good idea of what could be causing this problem or where to start looking.

By reading into the Android source code, it seems to be a warning you cannot do anything about. The source code shows that if you call
BluetoothSocket#connect();
Then it will call
BluetoothAdapter.getDefaultAdapter().getBluetoothService(null);
The key here, is the null parameter that it passes in the above line. Due to this, there will be no callback, and then the BluetoothSocket class will throw out a warning.
Since it is only a warning, I do not think you need to do anything about it.
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothSocket.java line 306
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/bluetooth/BluetoothAdapter.java line 1610

It appears that this gets called when multiple bluetooth sockets are opened at once. I fixed this by ensuring I was only opening 1 socket at a time.

I get this error even after my application has been closed and I can't get rid of it in any possible way. After this start happening I need to hard-reboot my phone because I'm not able anymore to even turn ON bluetooth.
Right now (with the same code) it happens only on one of my phones.. maybe it's an issues of the drivers.

This also comes up if the BluetoothServerSocket isn't currently accepting [bluetoothServerSocket.accept()] with the same UUID you are trying to connect.
If you are sure you are accepting with the server socket, double check that you haven't provided a too short timeout (I had previously set it to 200 to check something, whoops).

I received this message after trying to BluetoothSocket.connect() directly after receiving the BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED with a state of BluetoothHeadset.STATE_CONNECTED. The BluetoothSocket.connect() also failed. After adding a timeout of 500ms before trying to BluetoothSocket.connect() this resolved my issue of actually connecting. The message "getBluetoothService() called with no BluetoothManagerCallback" still remains but everything works.

getBluetoothService() called with no BluetoothManagerCallback
I am also facing the same problem. But I solved.
In my case already one socket is in open state and I am trying to open another socket. So we trying to open more than one socket at a time as a client. I felt that this is the reason

Related

SetTimeout() for NFC Tag Type NfcV Android Studio

I have a device for which one of its commands takes about 80ms to perform its operation before sending a response via NFC. This triggers the time out and returns an exception.
Android Studio is throwing me an android.nfc.TagLostException: Tag was lost. exception.
the NFC-V API does not have any setTimeout() method as some other NFC technologies.
Anyone knows any way I can extend the time period for the time out?
My workaround was to catch the exception and continue anyhow. I could do that, as I was sending a write command, where I do not need a response. This is not ideal, because you will not able to find "real" errors.
If you need the response, e.g. your command is a read command, then ignoring the exception may not work
The Hard coded timeout seem to be 100ms from https://android.googlesource.com/platform/system/nfc/+/refs/heads/master/src/nfc/tags/rw_i93.cc
And the answer is probably you cannot change it as
https://issuetracker.google.com/issues/36974890 was closed as "Won't Fix (Obsolete)"

Pusher Android Subscribed Channel Twice

I am a newbie for Android and Pusher.
We just migrated Pusher in Android Native App. However, we are facing a problem with the subscribed the Channel Twice(I think the connection will be twice too).
Checked that we just create the pusher object under the onCreate and establish the connection.
We also added the pusher.subscribe under onResume and unsubscribe under onPause, onDestroy.
As document said An exception will be throw when subscribe twice.
When I start the apps. I checked the logs with the attached debug message.
Showing two connections.
The attached file is my MainApp. Anyone can help? Many thanks. :) .....
* all subscribe and unsubscribed is added try .. catch .. exception now.
Thanks all. Since we are working this issue nearly 5 days...... Thanks all again and again.
2013-08-12 Update:
Hi all, i just amend the log and retest the program. The following is my result:
I checked that the connection is from connecting to connected once only. However, the pusher debug console show me:
- The Channel: 2235d980e0621a54
It is quite strange. We are still investigating this issue.
The updated new source is here:
Latest Source - MainActivity
A few clarifications:
When you create a new Pusher instance and call connect you establish a connection.
When you call pusher.subscribe('channel'); you create a subscription to a channel - not a connection
The code you've provided subscribes to the same channel in both the onCreate and the onResume. You don't need to resubscribe in onResume as the library handles this for you. This existing code could result in an exception being thrown. So, you can remove the onResume code and remove that problem.
I'm not sure why you would be seeing two connections. Could you please provide details of the client log from your application?

"Logged in" callback never called by libspotify on Android

I'm writing a NDK wrapper around libspotify on Android. But sp_session_callbacks:: logged_in callback never called.
This is content of tracefile:
libspotify trace from 12.1.51.g86c92b43 Release Android-arm
< sp_session_create() = 0
> sp_session_login(0x240ea8 'moodstream1#gmail.com' '<hidden>' 0) on 0x400fc4c8
This is a log received with sp_session_callbacks:: log_message callback.
13:30:07.361 I [offline_authorizer.cpp:297] Unable to login offline: no such user
13:30:07.372 I [ap:1752] Connecting to AP ap.spotify.com:4070
13:30:07.382 I [network.cpp:438] Connecting to 193.182.8.10:4070
13:30:07.526 I [ap:1226] Connected to AP: 193.182.8.10:4070
As you see session was created correctly.
I've tested on real devices and emulator. The result is the same. Any ideas?
The problem could be that they are not driving libspotify properly. This is one of the common problems that people have.
Specifically it is important to listen to the notify_main_thread callback. This indicates that libspotify needs to process some data from the GUI main thread.
sp_session_process_events should then be called from the GUI main thread. sp_session_process_events must also be called periodically based on the next_timeout value returned
The faq covers this https://developer.spotify.com/technologies/libspotify/faq/ and the sp_shell examples serves as an illustration.
can you provide a code snippet that shows such error? From a quick test (using the spshell example) I get the logged_in callback called correctly on Android.
As daek says, and judging from the output to the tracefile, it seems you're not driving the libspotify event processing using sp_session_process_events() and listening to the notify_main_thread callback.
When correctly implemented you should be able to observe a "sp_session_process_events" line now and then in the tracefile log.

IdleConnectionHandler removing a connection that never existed in my android app

My android app keeps logging this warning :
IdleConnectionHandler removing a connection that never existed
What does that mean? Is that a big problem? What should I do to avoid this?
My app makes many http connections in AsyncTask, is that related?
EDIT:
I found that this call was the reason of this message :
httpclient.getConnectionManager().closeIdleConnections(30, TimeUnit.SECONDS);
So maybe it tries to close some connections that don't exist?
It sounds like there is a logic error in your code. You may be able to track down the problems using this Android tool called ARO. You can find out more about it here http://developer.att.com/developer/legalAgreementPage.jsp?passedItemId=9700312
It will help you to understand more about how your application is using the network and how you can improve that part of your application to make it more efficient.
Is there a reason you need to make many http connections at once?
I got that error too, but my app uses internet only for ad loading. Currently I have no permission that my app can use internet, so that is why it says "Removing a connection that never existed". That may be one of the reason for this warning.

SIP outgoing call is not ended properly

In my application when i am making a outgoing call and if i ended it from my application its ended properly but when call receiver ends that call, sometimes it ends sometimes its not.
i debug the application many times and came to know that sometimes call goes into onEndCall() method and sometimes it does not.if call goes into this method it works fine.so what could be the reason for that?
I am using Android 2.3.3 and Asterisk 1.8.10.0
I guess you are experiencing a similar issue as me:
https://stackoverflow.com/questions/9875935/android-2-3-4-sipaudiocall-listener-oncallestablished-not-firing-every-time
Even in your case I think that the Listener that you connect to incoming calls (which are passed from the call receiver to your activity) is not always firing the methods. Therefore the call is closed in your application, but not in asterisk / on the other device.
I am sorry that I can't give you a solution, I am stuck by myself with this problem...
Best Regards,
Armin
EDIT 02/04/2012:
I have now - just for curiosity - changed VoIP server using the 3CX software and I am not able to reproduce the problem anymore!!! Maybe there is something in the replies of asterisk that causes the strange behavior! I will now start some wireshark tests to understand the difference between the messages of asterisk and 3CX and keep you updated!

Categories

Resources