we have a setup with a Django backend serving our native iOS and Android clients.
We have a couple of functions that we have implemented on each platform (for offline support etc) that we would like to have in a common framework.
My question is, is there any nice way to build a shared codebase that can run on these three platforms?
The three environments use very different languages. You have Java on Android, Swift or ObjectiveC on iOS and Python on your backend.
You may be able to embed Python in your mobile apps, and have them run a Python script (that will be the same code as the one you have on your backend), but it's going to take a while to get this just right.
I would keep the code implemented three times, unless it's really really complicated.
Related
I'm maintaining a plethora of apps for one of my clients all of which have native projects for each of the three main platforms. The apps are relatively simple in functionality. My client wants to always take advantage of the latest features in each platform for marketing opportunities. They also want to appear to be a native app (responsive, not laggy). I haven't followed cross-platform development very much lately, so that's why I'm reaching out to SO.
My initial idea is to write a C++ library that has all the functionality shared by the three platforms. Then, for each platform, I'll write some network, file access, and UI-code that connects the abstract library code to the concrete platform.
Of course, this is exactly what cross-platform systems aim to do. Would it be a waste of my time to write the above myself when this has already been done by platforms like PhoneGap? My concern is that I would be dependent on a third-party. If I write the code myself, I have full control, and I will always have access to the latest features.
Hope to get some pro's and con's.
Thanks!
Yet a third option (after Facebook's React Native and Microsoft's Xamarin) is Google's new Flutter and as the other answers suggests "then writing the Windows app purely natively". BTW, React Native does have Windows support the lack of which in Flutter could be a plus or a minus depending on how you look at it.
Have you considered using React Native for iOS and Android, then writing the Windows app purely natively?
There are tons of articles out there about pros and cons for React Native.
PhoneGap is just a web, written in HTML, CSS and JavaScript. React Native actually renders native components for iOS/Android.
There is also Xamarin. It supports multiple platforms and uses c#. The new features from the native languages all work great.
Can Nativescript build apps for web as well?
As Ionicframework and similar uses Cordova to build Android and iOS the same code there can be served by an HTTP server to the mobile or desktop browsers.
Will that be possible with the apps built with Nativescript, using same code base for web version of the app?
Nowadays Angular integration is on the way, and using Angular for the mvc kind of things (like data bindings, events etc.) and using Native for the device apis, platform apis and native gui would help in an unequaled way.
Angular parts can be used in the browser as well when built for it. What to do with the xml written for the gui templates in Nativescript, they could be converted to proper html for web built of the app, as Nativescript itself already uses a unified gui api for different platforms, that could be possible. And lastly, native calls made in NativeScript would be ignored in the web build.
It would be great to build for Android, iOS, and Web with the same exact code base.
tl;dr: No
Longer: The big difference between the Cordova/Phonegap based technologies (such as Ionic and Supersonic) and the Dynamic Runtime based technologies (such as NativeScript, React Native and Titanium) is that the first uses a HTML approach where the application is run by WebKit/Blink in a WebView. Looking on the Dynamic Runtime technologies there's no HTML Engine running your app, but rather native views and widgets. The framework (in this case NativeScript) is "just" a bridge between Javascript and the native language of the device.
However, depending of how you architecture your code, you can create Javascript which will be usable in both a NativeScript environment as well as in a browser environment.
Edit: The above means that you could reuse some of your code. There'll still be NativeScript specific code.
Edit2: There's an ongoing project to enable usage of Angular 2 in NativeScript. Please see current status in the issue: https://github.com/NativeScript/NativeScript/issues/103 Also note that the Telerik NativeScript core developer Valentin Stoychev is saying
The idea [is] to enable as much code reuse as possible between your web and mobile apps.
So: Yes on code reuse - no on exact same codebase.
Adding to the (correct) response of Emil - I do not think it is possible to have any significant portion of the app shared (even for the logic part) since {N} apps mostly utilize the Nativscript observable implementation which would probably 'leak' into your models / view models.
Having said that, I suggest you to monitor the work happening on integrating Angular2, which would probably mean a larger code sharing potential (with Angular2 web apps)
We have just reached some sort of a brick wall in our project and would
appreciate some comments or suggestions or pointers, anything at all.
Problem Statement
Making a web-technologies (html5/canvas) based mobile/tablet app that can
do some natural language processing.
Our Constraints
For UI, we are more reliant on prototyping it with html5 technologies
like the Canvas api, SVG. It aligns a lot with our skills and has the
requisite capabilities
NLP libraries are more mature and well developed in Python (like NLTK)
Some alternatives that we tried
Javascript based libraries for NLP. They might not be as matured, but
could have proved a faster alternative if there were JS libraries for NLP.
We found these:
Natural https://github.com/NaturalNode/natural
Other JS based libraries:
http://www.chrisumbel.com/article/node_js_natural_language_nlp
But they proved to be Node based and we couldn't figure out a way
to add them to a browser kind of page, so that we could embed it into a
"PhoneGap" type platform. We could be wrong.
To use Python NLP logic in our mobile app, we tried some cross
platform libraries:
PhoneGap http://phonegap.com/
This StackOverflow
responsePhoneGap with Django Backend
suggests
that "you cannot run python code on iOS or Android using PhoneGap"
Qt 5 http://qt-project.org/,
Qt5-mobilehttp://qt.digia.com/qtmobile/
There 2 promising Python Based Qt libraries:
PyQthttp://www.riverbankcomputing.com/software/pyqt/introand
PySide http://qt-project.org/wiki/PySide
This QML/Python/Qt
demohttp://qt-project.org/wiki/Using-QtWebKit-and-QML-with-PySideis
almost exactly what we want:
There is a Python backend with JS calling python objects and
vice versa using methods like: sendData(), receiveJSON() ...
But it doesn't seem to compile on our machines, and later we
found PySide development has stagnated and supports only
till Qt4.8,
whereas Qt5+ provides support for mobile/tablet development.
This blogpost details how some app developers used Python for
backend and QML for
UIhttp://blog.qt.digia.com/blog/2012/03/23/mixd-tv-leveraging-qt-quick-for-a-rich-desktop-ui-from-a-python-back-end/.
But its just descriptive, and doesn't give real information.
Kivi http://kivy.org/docs/guide/packaging-ios.html#:
Despite some niggles, it does seem to work but it doesn't seem
to have a way to develop a 'UIWebView' class based iOS app,
which we need
to use our html5 based UI.
Pythonista http://omz-software.com/pythonista/:
Same problem as Kivi above. We don't want to develop the mobile
app using Python, we just need a python backend for our html5
based webapp
iOS: We checked the native iOS development libraries also, but
couldn't find an easy way to embed a python backend logic
Android: ? Does anyone know if we could embed python into an
web-based app.
AJAX calls to Flask server:
This is the last option, that we are fairly confident about. Host
python logic on a Flask server and make AJAX calls from the webapp. But
given its for an application for kids, we might end up making
numerous AJAX
calls for same part-of-speech tagging
Any help/suggestions are most welcome.
I am new to PhoneGap, and I have several questions:
I need a way to develop an application that will have iOS, Android, and other platform compatibility. In other words, I want to write 1 app and get compatibility versions for different platforms.
By reading the "Get Started" guide linked by the PhoneGap website, I found there are different procedures for different platforms. So to have compatibility versions across platforms, do I have to go one-by-one and change all of them if I make a modification to my app?
Also, what exactly is PhoneGap Build? It seems like I can avoid all that hassle mentioned previously and toss my app into the PhoneGap Build? Do I really not have to do anything besides writing the app? What if I need to make changes?
And finally, I've read that PhoneGap works with HTML, CSS, and Javascript, but not PHP. What if my app needs to contact a server? Can PhoneGap handle that?
Thank you for bearing with all these questions!
PhoneGap achieves platform compatibility by embedding a webview within your application. Therefore you can apply your knowledge in HTML, CSS, JavaScript and it additionally provides ways to interact with native features (e.g. camera, gps, ...).
With PhoneGap you write one general web app, tweak parts for the specific platform (sometimes you do not have to this at all) and build it for that platform. The latter can be handled with PhoneGap Build service: It takes your webapp and bundles it for the mobile operating systems out there (Embeds it within a Java app on Android, an Objective-C app on iOs)
PhoneGap is able to communicate with a server hosting a PHP script just as every other web application. Trying to dynamically load resources from remote sites can be quite a hassle but this is another question.
traumalles is correct. All your HTML/Javascript/CSS is running from within a webview on the device. Your code is, therefore, all "client-side." You can communicate with a server just like with any other page. When they say PhoneGap isn't compatible with PHP, they mean only that PhoneGap can't execute PHP code like it's a server, because it's not. It's just loading your webapp in, basically, a browser.
One other important question is what exactly do you mean with "other platforms" phonegap does provide many functionality for nearly every platform but the different webbrowser of the mobile devices have their problems and limitations.
For example are there many problems if you want to provide your application on a WindowsPhone Device because the Webbrowser has a few limitations which will cause your app to not look and behave like a native app.
Just look a bit through the phonegap API you will see that some functions are just available for IOS or for Android and there are a few only Blackberry methods and so on.
So you really have to be careful when a framework tells you it will work on all devices.
So i really don't have a problem with phonegap i worked with it very great but there will be limitations you have to deal with.
If you primarily want to develop for IOS and Android you can really achieve great native like results !
I'm making a mobile game that has some complex game logic. I'd like to code the logic in JavaScript so that I can run it in a browser, and a server on node.js. However, I think I also need the logic to run on the mobile client (iOS / Android). Is there a way to run JS on iOS / Android, so that I don't have to write and maintain three separate code bases for one game rules?
I looked at PhoneGap.
Does anyone who's used PhoneGap recommend this, or vice versa?
My goal is to minimize having to maintain two or three codebases whenever the game rules are slightly modified.
One way to approach this is to build your application with JavaScript using a mobile JS framework (Sencha Touch, jQuery Mobile), then wrap it using PhoneGap (as you said) or a similar product, such as Titanium Mobile. This process is mostly painless, and can easily be automated.
As long as your application isn't complex graphically (such as a game) or require significant client-side computation, I would this is the best approach to writing cross-platform mobile applications.
If you need it to run fast, you could write your app in Appcelerator Titanium, where you write your code i Javascript. The Javascript code is then "compiled" into a native app.
See http://developer.appcelerator.com/
You can use Phonegap Build (build.phonegap.com) to maintain the same codebase for all applications. It just requires you to upload a zip with your html/javascript files and will generate bundles for all platforms. Though it is still recent, it is already very stable