Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem on android #114

Closed
mismej opened this issue Dec 7, 2014 · 15 comments
Closed

Problem on android #114

mismej opened this issue Dec 7, 2014 · 15 comments

Comments

@mismej
Copy link

mismej commented Dec 7, 2014

I have made simple code that initializes BT, then scan for devices. It works properly on iOS, but the same code on Android crashes app. How to debug it? What can be a problem?

@randdusing
Copy link
Owner

What's the error message you are receiving? And from what line?

@mismej
Copy link
Author

mismej commented Dec 7, 2014

App crashes and back to the system, so there is no any error message. It crashes on:

  • bluetoothle.initialize

I cant find in logcat any useful information.

@randdusing
Copy link
Owner

Post your bluetooth.initialize related code

@mismej
Copy link
Author

mismej commented Dec 7, 2014

function bluetooth() {
bluetoothle.initialize(btOK, btFALSE);
}

function btOK() {
alert("Bluetooth OK");
}

function btFALSE() {
alert("Bluetooth FALSE");
}

@randdusing
Copy link
Owner

Hmm, looks fine to me. Can you try using the example src and see if that gives the same result? And what version of Android are you running?

@mismej
Copy link
Author

mismej commented Dec 7, 2014

I'm using Android 4.4.2, cordova 4.1.2, Android API 19. Example works fine (?).

@mismej
Copy link
Author

mismej commented Dec 7, 2014

I have made very simple app - HTML load only cordova.js and my-app.js, my-app.js only initialize bluetooth and it also crashing... here is source: http://www.vad.org.pl/simple.zip.

Thanks (in advance ;) for all sugestions!

@randdusing
Copy link
Owner

Looks fine, but I can't really determine the issue without more log and crash information.

@mismej
Copy link
Author

mismej commented Dec 7, 2014

Sure - can you tell me what should I log? full logcat?

@mismej
Copy link
Author

mismej commented Dec 7, 2014

Here is logcat: http://www.vad.org.pl/logcat.txt. I think it's interesting part:

E/AndroidRuntime( 9102): FATAL EXCEPTION: pool-1-thread-2
E/AndroidRuntime( 9102): Process: com.test, PID: 9102
E/AndroidRuntime( 9102): java.lang.NullPointerException
E/AndroidRuntime( 9102): at com.randdusing.bluetoothle.BluetoothLePlugin.getStatusReceiver(BluetoothLePlugin.java:2423)
E/AndroidRuntime( 9102): at com.randdusing.bluetoothle.BluetoothLePlugin.initializeAction(BluetoothLePlugin.java:427)
E/AndroidRuntime( 9102): at com.randdusing.bluetoothle.BluetoothLePlugin.access$000(BluetoothLePlugin.java:37)
E/AndroidRuntime( 9102): at com.randdusing.bluetoothle.BluetoothLePlugin$1.run(BluetoothLePlugin.java:246)
E/AndroidRuntime( 9102): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 9102): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 9102): at java.lang.Thread.run(Thread.java:841)

@randdusing
Copy link
Owner

Ahh, I figured it out. Try adding an empty parameters object even if you aren't specifying any parameters. Or change line 427 to:

if (obj == null || getStatusReceiver(obj))

Will fix this when I make the next update.

@mismej
Copy link
Author

mismej commented Dec 8, 2014

Stil crashes app :(

@marciopuga
Copy link

I had the same problem. Passing the empty obj as parameter actually fixed it.

bluetoothle.initialize(initializeSuccess, initializeError, {});

@randdusing
Copy link
Owner

Or just make that conditional evaluate to true all the time.

@amittel
Copy link
Contributor

amittel commented Dec 9, 2014

Puhhh... Finally found it! Thanks! Took me a long day of searching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants