Sending data via bluetooth between Android phone and laptop running OS X - java

It seems like a relatively mundane task to make an app that can send data via bluetooth but I've been banging my head on this for the past few days so I'm looking for any ideas. I'm running OS X 10.10 and using a Nexus 5 Android device. Here's what I've tried so far:
I need a server program running on my laptop and I need a client-side android app running on my phone. However, (correct me if I'm wrong) the server program running on my computer needs to be able to access the Android Bluetooth API because I need to use the BluetoothServerSocket (based on the server-side code provided in Google's Android Bluetooth tutorial).
Since it's server-side code, I need to run it on a server so I built a Java Servlet which I ran from inside Eclipse but I didn't know how to access the Android API from inside a dynamic web application.
So I started following this approach where the Bluecove library made that possible: http://luugiathuy.com/2011/02/android-java-bluetooth/
I tried getting Bluecove to work with OS X but there are a whole host of issues involved with that. I found some workarounds and then got an error dealing with the IOBluetoothLocalDeviceReadSupportedFeatures device that Apple removed in its later OS versions (but Bluecove depended on it).
I found a fix here that installed the old IOBluetooth library and changed the DYLD_LIBRARY_PATH to point to it. Unfortunately, this had no effect (I don't know if I changed the library path properly...I followed the instructions from Solution 1 in the answer from this post).
In any event, I feel like I'm overcomplicating this task and am looking for any guidance - in terms of overall approach or a specific thing I missed. The primary issue is accessing the Android Bluetooth API inside the server program intended to run on my laptop.

I eventually ended up using WiFi to send data since there was better software support for that.
But if someone wants to pursue the Bluetooth path, one possibility is to run OS X Lion (which had the IOBluetooth library) as a VM and run the server-side Bluecove code on the VM. This would require a separate Bluetooth USB dongle to be attached because the VM can't access the bluetooth hardware of its host machine - there may be a way but by default it can't access the in-built bluetooth hardware.
Not an ideal solution but I don't know if there is much choice until Bluecove releases a version that is supported on recent OS versions.

Related

How to make a device available for a Bluetooth connection in Windows

I am developing an application that involves creating a Bluetooth connection between an Android device and a Windows 10/11 device. Getting the Android section working was pretty straight forward thanks to the detailed documentation, but not so much on desktop.
I want to get the local Bluetooth MAC address of my Windows device and then make it available from connection by the Android device which will use that MAC address to connect directly without needing to go through the discovery process.
I would like to use Java for the Windows application if possible. All I can find is from Oracle explaining it using the core Bluetooth API, but this seems to be removed from current versions of Java as the javax.bluetooth package isn't found. I'm using OpenJDK 17.0.2. Any similar stackoverflow questions I could find are extremely old and mention using this javax.bluetooth package which no longer exists.
Can anyone explain how we work with Bluetooth in Java in 2022? Are there any other languages that it is much easier to work with in you would reccommend over Java?

Lowest Android Version Possible For SNMP and PPTP

I'm having to create a new app for our installers and they currently have an app that they use on Android 5.1. It doesn't use either features mentioned in the title but I'm looking to implement that in the new app. I'm just curious what version do the new phones need at minimum to support an app that allows for both of those to be supported.
SNMP is going to be used to make calls to subscriber modules. Itll have to be able to use both Version 1 and Version 2. It'll be completely equipment based.
The PPTP connection will be only for the app itself. I don't want it to default all traffic the phone is using to that connection. Merely only what calls the app makes to the network. Is this even possible?
PPTP
I'd have to assume there are libraries out there for version of Android that didn't include it natively, it looks like v4.0 is the earliest Android version to include PPTP.
"Android includes a built-in (PPTP and L2TP/IPSec) VPN client, which is sometimes called legacy VPN. Android 4.0 (API Level 14)"
https://developer.android.com/guide/topics/connectivity/vpn
SNMP
The best thing I can find for SNMP is an app that uses SNMP on Android 2.3.3. Who knows what library or home-rolled code they used to do it, but it looks like you have some "wiggle room" if you're just needing it for Android v5.x.
https://snmp-agent-4a.en.aptoide.com/
Another link that shows the age of SNMP on Android doesn't say what OS version it's talking about, but we can see the images are of fairly ancient phones. It's circumstantial at best, but it looks promising for your project.
https://www.dpstele.com/snmp/monitoring-smartphone-best-practices.php

Java Application on Smartphone

What alteration should be made in a Java Application to be able to install it on Java Enabled Smartphone?
I tried using a random app of mine to see what happens, when I open it on the cell, it says Install? I say yes, and it says invalid file.
Now I was wondering what alteration should be made?
My smartphone (Samsung S8500) runs on bada which is more or less the same as Android, but alterations in the General.
You need different SDK for smartphones. Like for Android, you need Android SDK 1.5 or any other version. You just cannot install the same application. You need to develop using the resources provided by the SDK.
If your application is Java based mobile application then you can use some tools to convert it for Android. Doesn't work every time but worth a try.
In your case, Bada OS is not like Android what i learn from here. So, you need to develop the application using J2ME .

Java Bluetooth API

I want to implement bluetooth communication on my final bachelor project, but I'm having a lot of doubts.
One of the requisites of this project is to have a Java application that can talk to the micro via Bluetooth. After a lot of research, I've found one that I think it's very good with a SPP profile, but I still have a lot of questions about it:
All the bluetooth on a PC implements the SPP profile stack?
If you need to develop a Java application that runs on every PC that implements the SPP stack, how would you do it?
We started by trying to use BlueCove and JavaBluetooth.org API, the first one runs great but I don't know if it's just on my PC and the second one sends an error (Stack not initialized). Which one would you use, and why?
My main goal with the project it's having some kind of software that runs on every PC with bluetooth (inside or as an external device) and running JVM, but I'm not sure if this APIs are the way.
Thanks
All the bluetooth on a PC implements the SPP profile stack?
Yes - Windows / Linux and Mac does.
If you need to develop a Java
application that runs on every PC that
implements the SPP stack, how would
you do it?
As you are trying you can use a Java bluetooth api library like Bluecove or alternatively natively try and open serial port on these platforms and thus have different versions of the application one for each platform.
We started by trying to use BlueCove
and JavaBluetooth.org API, the first
one runs great but I don't know if
it's just on my PC and the second one
sends an error (Stack not
initialized). Which one would you use,
and why?
JavaBluetooth seems to be a full stack and based on very old 1.1 version of bluetooth spec.
Bluecove is just a Java library for bluetooth running over the native bluetooth implementations on Mac, Linux and PC.
I think Bluecove is probably the right way to go.

Networking with ios

I have an application that was written in Java and runs on the users machine. I now want to build an application on the iPhone which will communicate with my java app.
Can somebody point me in the right direction on how I can send and receive TCP packets with the iPhone, I want to of course be able to do that using wifi and 3G.
Thanks,
You use the NSStream classes. I've found it pretty easy to use.
See the SimpleNetworkStreams for an example.
One problem I found is that the iphone sdk does not include the NSStream method getStreamsToHost:port:inputStream:outputStream: which is what Mac OS examples use to open a NStream connection but there are lots of places that show you how to create your own like here.

Categories

Resources