Home » Android » android – What's the best way to develop a cross-mobile app with bluetooth support?

android – What's the best way to develop a cross-mobile app with bluetooth support?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I’ve read about the native feature-support of Phonegap here. Clearly, it makes no mention of Bluetooth support. I’ve failed in finding or locating any other platform with cross-mobile platform development support. As a result, I’m currently faced with two choices.

  1. Build independently for all the platforms (very painful option)

  2. Find a suitable cross-platform development solution (which I’ve not found yet).

My question is; for mobile developers out there, which option would you suggest I take, one not listed here? If possible also help with details of pros and cons.

Thank you very much.

How to&Answers:

Build independently for all the platforms (very painful option)

In my experience, this is by far the least painful option, and not just for Bluetooth. The overhead of dealing with leaky cross-platform abstractions tends to outweigh the benefits by the time you get to a real, production product. Build an excellent iPhone app. Build an excellent Android app. You can share a lot of the UI design (though not all of it). You can share much of the data structure design. You can share some of the internal architecture. You can share any network protocols (particularly if you design them in JSON). But avoid code sharing and avoid shooting for the least-common-denominator. It’s pretty far down….

For some kinds of projects it makes sense to share some C++ code between platforms. Trying to develop this stuff in JavaScript is a recipe for frustration the moment you go beyond the most basic of applications. It’s easy to hack up something in mobile JavaScript that kind of works. It’s very hard to get it to look and work great on all platforms; much harder than just writing them natively in the first place.

Some more discussions on this:

Answer:

You list iOS as one of your desired platform. On iOS, any generic Bluetooth communication (other than Bluetooth LE or communication via Gamekit, headset or keyboard) is available only to Apple MFi program licensees. To get any details about this license, you need to apply to Apple’s MFi program first. AFAIK, no 3rd party or cross platform tool chain can help you with this for iOS.

Answer:

I don’t believe the OP is talking about iOS app to device communication but rather peer-to-peer bluetooth communication. Would the requirement for Apple MFi program licensing apply?

If so, are the peer-to-peer Bluetooth APIs (and hardware) on say, Android or Windows Phone 8 be compatible with the one from iOS? And if they were, shouldn’t passing data around by JSON be fairly straight-forward for building cross-mobile apps?

IMHO, for simple business apps, building native apps for each platform is the way to go if you want to make full use of available resources on each platform and conform to their differing UI design principles.