This is for a research project at school so this is somewhat urgent. We need to know if this technology exists, or if it would require us to build something native for each device.
Is it possible to use any frameworks or tools to access Bluetooth sensors from a non-native application. For example, I gather that HTML5 applications will can access some sensors, but need bridging frameworks to access others (i.e. PhoneGap). Are there any other apps that have tackled this problem in the past that we can research?
With iOS you need to use it through GameKit, and even then there are big restrictions. With android your application has to specifically request access to bluetooth with permissions.
As far as I searched, it's not possible to use raw HTML5 to access to mobile native features such as Bluetooth on mobile devices. The only way so far that I have found is to use cross-platform mobile application development or native apps. Just keep in mind that not all cross-platform frameworks support all phone native features like Bluetooth. I think the one you mentioned, PhoneGap, does not support Bluetooth. It would be great to put comments if have you come up with any solution for your post.
Check this link to get some idea about different frameworks and their features.
Related
I intend to port a Qt desktop application to Android. It uses QSerialPort to communicate with an external device (which has a built-in CP210x)
The application, although written purely in Qt and C++, runs fine on Android, but it doesn't see the device. The CP210x official driver download page recommends to compile the kernel on Android from source, which is not feasible to expect from the average customer. Other recommendations I found online recommend jailbraking the phone, which also isn't something we could expect end users to do.
There are scant few questions in this topic on the Qt forums, most saying that QSerialPort's Android support is quite limited. However, these topics are often at least 6-7 years old.
An Android developer forum/wiki/tutorial? recommends to use "Android Things", whatever it is. I couldn't find any apps fitting that description.
I know that it's physically possible to use serial-usb on an non-jailbroken Android, as I tried out a serial console app and it worked, I could successfully exchange data with my device.
Does this mean that the only was is to develop my own wrapper in Java, and use JNIEXPORT? That would break the easy multi-platform compilation I used before (just selecting a different kit from Qt Creator) Are there any simpler ways to accomplish this? Is USB OTG usage so low that no one else thought to implement anything in this regard?
QSerialPort has only a non-official partial Android Support (see https://wiki.qt.io/Qt_Serial_Port).
(... Use on own risk, only for rooted devices, in which is it possible to get/set a permissions to the /dev/ttyXYZ nodes)
You can use JNI to get a FileDescriptor with permission and then use the libusb library in C++ to communicate with device.
But yes, it would break the easy multi-platform compilation.
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.
Build independently for all the platforms (very painful option)
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.
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:
Mobile development - Native VS Cross Platform VS JavaScript
How to code sharing between Android and iOS (Where I discuss how to share large, established C++ code bases. But this isn't applicable for new development.)
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.
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.
I am investigating options for a web app aimed at mobiles and one of the options is to write a standalone app that does not connect to the internet at all. Does it make sense to consider using HTML5 for this? The main reason for considering HTML5 as far as I'm concerned is the fact that it works cross-platform, but I just don't know if it makes any sense to consider this option if it will only be used offline once it has been initially downloaded.
Thanks in advance for your help!
As mentioned, this is definitely possible. I think the other answers don't quite give enough information, or understand the question, so let me provide a bit more.
Yes, it is possible to create a mobile app in HTML, either from scratch by using PhoneGap as the platform, or by using a mobile framework such as jQuery Mobile.
PhoneGap allows you to create true mobile apps using HTML5, CSS & JavaScript, and utilising the PhoneGap API to utilise features found in smartphones such as a camera, motion sensor, gps, storage etc.
Using jQuery Mobile, you'll be creating a mobile website, which must be accessed using the phone's browser, however you are able to incorporate this framework into the PhoneGap platform. This allows you to create a more native feeling app in HTML5.
I think the question you should be asking is what language should I use?. It doesn't matter if the app is used online or offline. What matters is what language or platform you want to write it in. There are downsides to using HTML5 to write mobile apps (speed, scalability, quality, approval to name a few).
I don't see a problem for doing so. HTML5 gives you ways to store information locally and a big set of other functionnalities. This could help you find if there is what you want regarding the mobile browsers (and Androïd's): http://caniuse.com/#feat=namevalue-storage
Then you may look into MVC frameworks like dojo toolkit (if you want widgets out of the box), backbone.js and so on.
Yes, it's possible. in fact many cross platform app out there is using HTML5 or javascript.
you could take a look on phonegap.com. It's cross platform using html5
Yes, it's perfectly possible to create an application with HTML5 (and javascript if needed).
Coding your app in HTML5 makes it easier to port to other mobile OS.
Just keep in mind that HTML5 is not definite yet, so you MAY have to rewrite certain parts after some time.
Phonegap can be used for this, as some already suggested.
If you're comfortable with java, but just want a HTML5 app so you can port it later,
you can use Google GWT (which converts java into HTML5 and javascript)
It's possible, but I don't think it's the best choice for an app that won't connect to the web at all. HTML5 offline apps are designed to work for the short periods of time where there is no web connection, not really for apps that will never connect to the web. Plus, HTML5 local storage is limited. I'm not sure what the limitations are off of the top of my head, but I think you'd be better off taking another route.
Definitely! There are already developers looking into it. HTML5 has native like capabilities, such as writing to its own DB and etc. Like they said, HTML5 is not definitive yet, so it might take awhile for it to be feasible and adopted by all.
Imagine 1 language to rule them all :)
I have just started researching creating mobile apps and from what I understand one big advantage of using HTML5/Javascript is that you can write one application that works with both Android and iOS.
I have also read that one of the drawbacks is that there are certain things that you can't do with HTML5/Javascript that you can with a native mobile app.
Is what I stated above correct? What will I not be able to do if I decide to go the HTML5/Javascript route?
While both native and web have their own positives and negatives, the one main advantage that native apps had over web apps was "Offline Access"
However that is now changing as HTML5 has support fo Offline Web Applications.
Some things for iOS:
Background audio/sound effects
Address book
Leverage CoreGraphics & OpenGL for advanced drawing
Camera access
Accelerometer
Limited Calendar Access
It all depends on what you are going to do. If your app needs GPS, the accelerometer, or is very graphics intensive, then a native app is the only way to go.
Otherwise, I would go with something like Sencha Touch for your app for a couple reasons. First off, if you release an update with a HTML5 app, you don't need to force everyone to download it, it will update automatically. Also, as you mentioned, you only need to write one application for all mobile platforms, which expands the potential user base. Lastly, I think the internet on phones is getting fast enough to support internet applications very well, and this is only going to improve in the days to come.
Basically, it all depends on the specific needs of the application. Personally, I would go with HTML5 whenever possible, due to the mobility it gives you with platforms.
I think we can separate this into two lists...
What can be done on a mobile device that is not possible in HTML5:
Push Notifications
Advanced Graphics (3d, OpenGL)
File Uploads (possible on Android but not iOS)
Connect to Address Book
Connect to Calendar
What can be done in HTML5 but is easier or implemented better on mobile devices:
Camera Access
Offline Use
Device Location Services
Sound
Accelerometer
Speed / Slickness of UI (hard to quantify, but apps typically still feel nicer when native)
(Please note the date this was answered on, this landscape could be quite different in 6-12 months or more.)
In theory not much, if you use titanium. http://www.appcelerator.com/products/titanium-mobile-application-development/
Unlimited Extensibility
Titanium’s plug-in architecture allows you code modules in Objective-C or Java to
extend your mobile app with custom native functionality and then call those
modules using Javascript in Titanium.
Though i have never used Titanium and dont know how well this works. I would stick with native development anyhow ... for now.
I've come across a few suggestions of "develop-once, deploy anywhere" mobile frameworks from other SO questions:
http://www.mosync.com
http://rhomobile.com
http://phonegap.com
I was wondering if there are other alternatives to these mobile frameworks. None of them have the ability to access call logs or hook into a phone's call events (I realize those aren't possible on iPhone).
The problem is that the ability you want is pretty specific to the device, so it is unlikely anyone will come up with a framework in the near future that supports it.
That said, PhoneGap supports adding any native code you desire, so you could do the bulk of the app in it and then add native code for the bits that are not supported. It's a lot easier than creating apps from scratch for each platform.
There's Appcelerator Titanium Mobile for Android/iPhone, but I don't know if it can do what you're looking for, either.
The Qt Mobility project is the only one with such functionality i think but i am not sure, more info at http://labs.trolltech.com/page/Projects/QtMobility
more info:
http://qt.nokia.com/developer/new-qt-apis
platforms supported:
http://qt.nokia.com/doc/qtmobility-1.0-tp/index.html#platform-compatability