I installed the Android SDK and had a closer look.
It looks relatively easy to make a port of BT747 to the Android platform: it does look like plain Java. The fact that some libraries are not the same is not an issue: that is already the case with the three platforms that BT747 can run on: J2ME, J2SE and SuperWaba.
Porting BT747 is a matter of:
If you volunteer to do most of the work, let it know. I'll assist where needed.Kind regardsMario
+1 BT747 for Android would
+1
BT747 for Android would kick.
Tried running the J2ME.jar using netmite but had no luck. The midlet would run and scan for bluetooth devices but would not find the 747.
Sorry, I know nothing about programming, otherwise I would be happy to help with the development. Best.
-H.
Hi Hector That is an
Hi Hector
That is an interesting hint. I just looked at <a href="http://www.netmite.com/android/">Netmite</a> and according to the release notes Bluetooth support was added in 1.6.0.7.
The release notes also say that you need to check out the permissions on /dev/socket/bluetooth and /dev/socket/dbus_bluetooth that have to be srwxxrwxrwx .
What version did you try? Did you check (and correct if needed) the permissions?
Hi Apparently it is possible
Hi
Apparently it is possible to create a package on the site directly which is what I did - I put it at http://soft.bt747.org/BT_J2ME.apk .
I've tried this in the emulator provided by google and the 'Live Android CD' in an emulator.
I learned that:
So, I can not do much in the emulator for the moment.
To understand what is happening on the device, one would need to get the 'logcat' from the device. I am not sure how to do that on a device. Throught the emulator functionality (adb), I can do a 'logcat' and see messages like these:
BT747's log file setup (but apparently failing:)
W/System.err( 571): [Info] Setup up console to file
V/@@@ERR ( 571): [Thread-10]:Connector.open(file:///root1/BT747Console.log,3,false
V/@@@ERR ( 571): [Thread-10]:Connector.open(file:///root1/BT747Console.log,3,false
V/@@@ERR ( 571): [Thread-10]:Connector.open(file:///root1/BT747Console.log,2,false
W/System.err( 571): [Info] Setup up console to file
W/System.err( 571): [Info] Basedir set to:/root1
Bluetooth can not be loaded:
D/dalvikvm( 571): Trying to load lib /data/data/com.netmite.andme/libbluecove-2.1.0.51-1607.so 0x43b7c2b8
I/dalvikvm( 571): Unable to dlopen(/data/data/com.netmite.andme/libbluecove-2.1.0.51-1607.so): Cannot load library: link_image[1721]: 30 could not load needed library 'libbluetooth.so' for 'libbluecove-2.1.0.51-1607.so' (load_library[1051]: Library 'libbluetooth.so' not found)
BT_J2ME detects issue in bluetooth discovery and cancels it (which is normal) (messages [Info] and [Error] are from BT_J2ME):
W/System.err( 571): [Error] Problem with Bluetooth device discovery.
W/System.err( 571): [Info] Canceling Bluetooth device discovery.
Stack overflow happens somewhere and this unexpected exception is not really handled in BT_J2ME:
I/dalvikvm( 571): Stack overflow, expanding (0x42700200 to 0x42700000)
I/dalvikvm( 571): Shrank stack (to 0x42700200, curFrame is 0x42700344)
W/System.err( 571): [Warn] Unhandled exception in hideNotify() of Finding GPS...
And that latter issue seems to be the main reason why BT747 'blocks'. However, it is not clear if that is the raised exception in Java.
That is for the emulator, so it would be interesting to see what happens on the device.
I am intending to buy an
I am intending to buy an Android based phone very soon (unless the reports on the recent 2.1 upgrade for the model I've chosen indicate problems).
Count me in (unless you get other volunteers by that time). One caveat: not sure how much time I'll be able to spare but since some of my upcoming trips are actually vacation I'd sure want to have BT747 available (without resorting to a J2ME enabled phone, as I do now; not that there's any problem with that BTW, it works just fine).
Hi rt An unhandled exception
Hi rt
An unhandled exception has been reproduced on a regular J2ME platform and I finally managed to get an unhandled in an emulator too after solving an issue in the GUI library I am using. I am not sure the issue is the same, but the exception is an out of memory error. Currently I am still puzzled why that consistently appears after solving the other library issue, but at least it is consistent now.
I made some changes but
I made some changes but unfortunately the netmite server is down and conversion in the emulator does not work. Anyway, if you want to try it, you can use the 'Netmite App Explorer', do 'Menu', 'Go to URL' and type 'http://soft.bt747.org/J2ME'. Then select either BT_J2ME.jad or BT_J2ME.jar. Either the conversion works or you get an error saying you need to contact the application author.
For the latter case, I sent a message to the Netmite author regarding the conversion failure on Android itself (in the emulator).
The netmite server is up
The netmite server is up again and I was able to convert the application.
Bluetooth will not work yet because of a general issue, but the application now runs normally on Android.
You can install from http://soft.bt747.org/J2ME (select the 'apk' file) and you'll need to have netmite installed as mentionned earlier.
In the netmite configuration you need to disable the 'Auto detect Game Canvas' (Menu/=System Menu=/=Settings= ).
Now I am going to fix this general bluetooth connection issue (also on normal J2ME platforms).
I have built 0.3.61 of the
I have built 0.3.61 of the application and put the '.apk' file on the server. In the emulator things look encouraging: I get a formal complaint in the application log that the bluetooth library is not found and an error screen about it. Then I can go to the main window. The error was not reported earlier which was an indication that the bluetooth connection was not really tried.
So I'll let you try at http://soft.bt747.org/J2ME . Do not forget my instructions in the previous post.
Hi Mario, I leave for a
Hi Mario,
I leave for a couple of days and look at the progress. Sorry about the delayed response. Your .apk seems to be working in my device, minus the bluetooth connection. All of this is way over my head and your efforts are much more productive than mine were when I was running the .jar directly in netmite (ver: 1.7.0.2) without creating the .apk.
I understand that Android has some inherent issues with its bluetooth stack and I have not been able to find an application which allows NMEA data to be utilized from an external device. I was looking into a project being worked on at 'http://code.google.com/p/android-bluetooth/' which I believe would allow serial connections over bluetooth in Android. Although, again, way over my head.
I appreciate your work and expertise and I'd be happy to help within my capabilities. I am using an HTC Hero running Android 1.5. Let me know if I can be of help.
Cheers, -H.
Good to know that it works
Good to know that it works (minus the bluetooth) on an actual device.
Netmite includes a bluetooth library so you do not need to refer to android-bluetooth (you can not even do that in fact) - possibly netmite uses android-bluetooth, but I think not.
To get some debug information from your device, we can look at the application log for starters (the 'logcat' log is more interesting, but I do not know how to do that on a real device).
Regarding bluetooth, 'libbluecove' is included with 'Netmite', but you need to have a 'libbluetooth.so' on your system somewhere - I guess that in case you have bluetooth that is installed indeed. The other thing I mentioned before (which is mentionned on http://www.netmite.com/android/ ) is that you need to check /dev/socket/bluetooth & /dev/socket/dbus_bluetooth if permission is srw-rw---- then you have to change it hange to srwxxrwxrwx . I am not 100% sure how to do that - in the emulator 'chmod 777 ' does not work very well since I do not know how to get the root priviliges.
Thanks Mario, Pasted
Thanks Mario,
Pasted application log below:
[Info] Setup up console to file
[Info] Basedir set to:/sdcard
[Info] Version 0.3.61
[Info] Before main.show
[Info] Discovering Bluetooth devices.
[Error] Problem with Bluetooth device discovery.
(javax.bluetooth.BluetoothStateException: Bluetooth Device is not available)
[Info] Returning Discovery Error
[Info] Discovering Bluetooth devices.
[Error] Problem with Bluetooth device discovery.
(javax.bluetooth.BluetoothStateException: Bluetooth Device is not available)
[Info] Returning Discovery Error
[Info] Setup up console to file
[Debug] Screen switched to Log
[Debug] MainScreen showNotify
[Debug] MainScreen setupScreen
[Debug] Screen switched to MTK Logger Control V0.3.61
[Debug] Screen switched to Log
[Debug] Screen switched to Connection
[Info] Discovering Bluetooth devices.
[Debug] Screen switched to Finding GPS...
[Debug] Starting Bluetooth device discovery
[Error] Problem with Bluetooth device discovery.
(javax.bluetooth.BluetoothStateException: Bluetooth Device is not available)
[Info] Returning Discovery Error
[Debug] Screen switched to Discovery Error
[Debug] MainScreen showNotify
[Debug] MainScreen setupScreen
[Debug] Screen switched to MTK Logger Control V0.3.61
[Debug] Screen switched to Log
[Debug] Screen switched to Logger
[Debug] Screen switched to Log
[Debug] Screen switched to App Settings
[Debug] Screen switched to Log
[Debug] MainScreen showNotify
[Debug] MainScreen setupScreen
[Debug] Screen switched to MTK Logger Control V0.3.61
Not sure how I check permission settings on those files, I'll do a little research and find out. I do have root access on my device as well as a terminal emulator application, I just do know the commands. Working on it. Anything else?Cheers. -H.
Okay, changed permissions
Okay, changed permissions to srwxrwxrwx (note: not srwxxrwxrwx). No luck with bt connection.
Application Log:
[Info] Setup up console to file
[Info] Basedir set to:/sdcard
[Info] Version 0.3.61
[Info] Before main.show
[Info] Discovering Bluetooth devices.
[Error] Problem with Bluetooth device discovery.
(javax.bluetooth.BluetoothStateException: Bluetooth Device is not available)
[Info] Returning Discovery Error
[Debug] Screen switched to Log
[Debug] Screen switched to Log Options
[Debug] Screen switched to Level
[Debug] Screen switched to Log
[Debug] MainScreen showNotify
[Debug] MainScreen setupScreen
[Debug] Screen switched to MTK Logger Control V0.3.61
[Debug] Screen switched to Log
[Debug] Screen switched to Connection
[Info] Discovering Bluetooth devices.
[Debug] Starting Bluetooth device discovery
[Debug] Screen switched to Finding GPS...
[Error] Problem with Bluetooth device discovery.
(javax.bluetooth.BluetoothStateException: Bluetooth Device is not available)
[Info] Returning Discovery Error
[Debug] Screen switched to Discovery Error
[Debug] MainScreen showNotify
[Debug] MainScreen setupScreen
[Debug] Screen switched to MTK Logger Control V0.3.61
[Debug] Screen switched to Log
[Debug] MainScreen showNotify
[Debug] MainScreen setupScreen
[Debug] Screen switched to MTK Logger Control V0.3.61
[Debug] Screen switched to Other
[Debug] KeyPressed
[Debug] KeyPressed
[Debug] Store settings
[Debug] Stored BT URL null null
[Debug] Store settings
[Debug] Stored BT URL null null
Thanks. -H.
Hi Ok, it seems that the
Hi
Ok, it seems that the problem may be with the driver. To know more about it we need the logcat information regarding this error. I've looked around again and found a program that will allow you to see it on the device. I added the link to the apk on http://soft.bt747.org/J2ME . You can look at the system log on the device and save it to a file (you can not choose the path, hopefully you have some means to retrieve it).
When you have the log, try attaching it (Webfm below the comment entry window) rather than paste it - thanks.
You should look for something like this in the error log:
error Problem with Bluetooth device discovery.
(javax.bluetooth.BluetoothStateException: BlueCove libraries not available)
c.a.b.b.a(null:-1)
error MIDlet caught javax.bluetooth.BluetoothStateException: BlueCove libraries not available
c.a.b.b.a(null:-1)
javax.bluetooth.BluetoothStateException: BlueCove libraries not available
at com.intel.bluetooth.BlueCoveImpl.createDetectorOnWindows(BlueCoveImpl.java:896)
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:439)
at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:65)
at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1020)
at java.security.AccessController.doPrivileged(Native Method)
at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1018)
at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1011)
at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75)
at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95)
at net.sf.bt747.j4me.app.b.g.a(Unknown Source)
at net.sf.bt747.j4me.app.b.a.a(Unknown Source)
at net.sf.bt747.j4me.app.b.a.g(Unknown Source)
at net.sf.bt747.j4me.app.a.b.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at org.microemu.app.util.MIDletThread.run(MIDletThread.java:99)
error [Info]
c.a.b.b.a(null:-1)
error Returning Discovery Error
c.a.b.b.a(null:-1)
error [Info]
Also, on the device, go to
Also, on the device, go to the 'Dev tools', open a 'Terminal' (bottom selection in the emulator).
In the Terminal, type:
ls -l /dev/socket
Tell us what you see for the entries with 'bluetooth' in it.
For instance you will see:
srw-rw---- root root 2010-03-23 13:00 bluetooth
srw-rw---- root root 2010-03-23 13:00 dbus_bluetooth
These devices should show srwxrwxrwx at the head - otherwise that has to be changed.
If you have a rights problem
If you have a rights problem on the bluetooth devices in /dev/socket , the way to become root is apparently to use the Android SDK.
So, you need to:
adb shell
su root
cd /dev/socket
chmod 777 bluetooth
chmod 777 dbus_bluetooth
ls -l
exit
The above will (a) make you root, (b) put you in the socke directory, (c,d) change the rights, (e) show the directory content so that you can verify those rights, (f) exit the shell.
adb logcat -d > logfile.txt
That will put the 'logcat' content in a file on your desktop that is called logfile.txt .
That is 'it'.
I can confirm the permissions
I can confirm the permissions for the bluetooth and dbus_bluetooth files are srwxrwxrwx. I have been running logcat.apk, though I am having difficulty retrieving the log file after saving it. I will download the SDK and use the instructions in your last post. Will post the log here.
I compiled the log. I'm not
I compiled the log. I'm not seeing the WebFM link. Log file at <http://dl.dropbox.com/u/4706302/logfile.txt>
Keep me posted.
-H.
Hi Hector I solved this
Hi Hector
Bluetooth is on and idle. I
Bluetooth is on and idle. I checked the bluetooth and dbus_bluetooth file permissions several times, they look good.
Thanks for the follow up. I'm still happy to participate in any way that I can. Let me know.
Cheers. -H.
Just another idea: did you
Just another idea: did you pair the bluetooth device on the core system already? Maybe in Settings/Wireless & Networks/Bluetooth Settings (manage connections, etc).
Yes, I've paired my iblue 747
Yes, I've paired my iblue 747 to my android device.
I've been trying out other applications in netmite which utilize the bluetooth connection and I'm not having any luck with those either. I keep getting an error asking me to turn my bluetooth radio on, or telling me that a bluetooth device is not available, etc. This appears to be a configuration issue and not an issue with the bt747 apk. I shot an email to the Netmite dev. Perhaps there's something else that I'm not doing right. -H.
How did you pair it? On my
How did you pair it?
On my Phone, it always says passcode is wrong! (I use "0000")
Hi I had a look at netmite
Hi
I had a look at netmite again and I saw that a new version is out, so I reconverted BT747. As a reminder, the links to get the BT747 apk is at http://soft.bt747.org/J2ME/ . There is also a link to get netmite itself from their page.
On my rooted 2.1 Spica
On my rooted 2.1 Spica (Samsung i5700) this doesn't seem to work at all -- after installing Netmite and BT747 apk I get a Netmite error (not sure what it was, I can reinstall it and paste the message if it is going to help).
BTW, Spica has it's own J2ME emulation layer provided by Samsung -- sadly, the BT747 jar file won't work with this either.
Any ideas?
'rt', I guess that you tried
'rt', I guess that you tried the correct flavor of BT747 by installing a BT_J2ME.jar file.
From what you write, I have little info to go on - I know it is a specific Samsung model with Android but I am not sure what "it does not work" means.
Does the application at least start (Netmite, native J2ME?);
What does the log say ?.
J2ME is a headache regarding credentials. Make sure that you accept the security exceptions and/or that these are configured for BT_J2ME.
Yes, I did try the J2ME
Yes, I did try the J2ME version. I did not have high hopes since this version isn't really usable even on my old phones with real J2ME implementation (K800 / C905) but I wanted to see whether it at least starts. It doesn't, the phone complains about invalid jar file. Maybe I am doing something wrong here.
I'll try to get the logs/ error messages.
Out of curiosity: have you considered http://www.microemu.org/ ?
I think it is what Trekbuddy uses for its Android port (I might be wrong here, though) -- and it works flawlessly with my Bluetooth GPS. To the user it looks like a native APK, it's no different from other apps on the Market.
Actually, the J2ME version
Actually, the J2ME version runs in microemu on the desktop for demonstration purposes. There is a link (jnlp) on the following page that also has the other J2ME links:
http://soft.bt747.org/J2ME/
I looked for android and microemu on the web and stumbled on this page again:
http://microemu.blogspot.com/2008/11/running-java-me-applications-on-and...
That is about a port of microemu to Android. When I looked a long time ago, it looked liked this project was dead, but recent entries show that it is alive, including a google group:
http://groups.google.com/group/microemulator-support
So, that could be another way of doing it. I currently can't investigate that path though.
I gave it another try today
I gave it another try today with the latest version of J2ME version. It installed, which is great.
What's not so great though is that it won't really start due to the lack of Bluetooth implementation in the emulator:
java.lang.NoClassDefFoundError: javax/bluetooth/BluetoothConnectionException
Speaking of the emulator, it is a product called "jBlend[micro]", version 1.0.0.3304 by Aplix:
http://www.aplixcorp.com/en/products/jb_micro/java.html
What is interesting here is that it says that is does support JSR-82 in the website above, however the "About" screen of the emulator does not list it among the supported APIs. I can only guess that this is due to i5700 Spica being first released with Android 1.5 which did not offer any kind of usable bluetooth support; apparently this legacy version of jBlend remained even though Android was upgraded by Samsung to 2.1 on this model.
This pretty much kills any hopes of running BT747 or other J2ME apps relying on Bluetooth natively on this phone. Hopefully this info helps anyone researching this.
As for running it with
As for running it with Netmite, it simply FCs -- "The application Java J2ME Runner (process com.netmite.andme) has stopped unexpectedly. Please try again. [Force close]".
As for logs, the following part looks most interesting:
V/@ERR@ ( 2668): Problem with Bluetooth device discovery.
V/@ERR@ ( 2668): (javax.bluetooth.BluetoothStateException: Bluetooth Device is not available)
V/@ERR@ ( 2668): javax.bluetooth.BluetoothStateException: Bluetooth Device is not available
V/@ERR@ ( 2668): at com.intel.bluetooth.BluetoothStackBlueZ.nativeGetDeviceID(Native Method)
V/@ERR@ ( 2668): at com.intel.bluetooth.BluetoothStackBlueZ.initialize(Unknown Source)
V/@ERR@ ( 2668): at com.intel.bluetooth.BlueCoveImpl.setBluetoothStack(Unknown Source)
V/@ERR@ ( 2668): at com.intel.bluetooth.BlueCoveImpl.detectStack(Unknown Source)
V/@ERR@ ( 2668): at com.intel.bluetooth.BlueCoveImpl.access$500(Unknown Source)
V/@ERR@ ( 2668): at com.intel.bluetooth.BlueCoveImpl$1.run(Unknown Source)
V/@ERR@ ( 2668): at java.security.AccessController.doPrivilegedImpl(AccessController.java:205)
V/@ERR@ ( 2668): at java.security.AccessController.doPrivileged(AccessController.java:178)
V/@ERR@ ( 2668): at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(Unknown Source)
V/@ERR@ ( 2668): at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(Unknown Source)
V/@ERR@ ( 2668): at javax.bluetooth.LocalDevice.x_a(Unknown Source)
V/@ERR@ ( 2668): at javax.bluetooth.LocalDevice.getLocalDevice(Unknown Source)
V/@ERR@ ( 2668): at dy.a(Unknown Source)
V/@ERR@ ( 2668): at cq.a(Unknown Source)
V/@ERR@ ( 2668): at cq.b_(Unknown Source)
V/@ERR@ ( 2668): at dv.run(Unknown Source)
V/@ERR@ ( 2668): at java.lang.Thread.run(Thread.java:1096)
V/@ERR@ ( 2668): at com.netmite.andme.MIDletThread.run(Unknown Source)
I/ActivityManager( 1940): Process com.netmite.andme.launcher.bt_j2me_midlet_suite (pid 2662) has died.
and maybe:
E/dalvikvm-heap( 2668): 499200-byte external allocation too large for this process.
E/ ( 2668): VM won't let us allocate 499200 bytes
D/AndroidRuntime( 2668): Shutting down VM
W/dalvikvm( 2668): threadid=3: thread exiting with uncaught exception (group=0x4001b180)
E/AndroidRuntime( 2668): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 2668): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
E/AndroidRuntime( 2668): at android.graphics.Bitmap.nativeCreate(Native Method)
E/AndroidRuntime( 2668): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
E/AndroidRuntime( 2668): at com.netmite.andme.lcdui.CanvasBufferingView.<init>(Unknown Source)
E/AndroidRuntime( 2668): at com.netmite.andme.lcdui.x_x_bc.run(Unknown Source)
E/AndroidRuntime( 2668): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 2668): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 2668): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2668): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 2668): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2668): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 2668): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 2668): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 2668): at dalvik.system.NativeStart.main(Native Method)
Hi there, After saying goodby
Hi there,
After saying goodby to Nokia I now own an Android phone, I used BT747 on my Nokia and now I see that there is nothing simular to this on Android yet. I don't know if this is the right place to ask, but I started to build a native download app for my i-Blue 747 and would like to know if anyone wants to help improve my app?
So far I have been able to create an app that start bluetooth on the phone, connect to my GPS receiver, opens a file on the SD card and send and receive data from and to the GPS device.
This is my first Android app so my code is very basic.
Bastiaan