How to provide JavaScript library for mobile native apps? - javascript

I am not a mobile developer, hence please excuse me for incorrect assumptions, if any
I have a library which users want to integrate in their native mobile apps. It is written in JavaScript, but I don't want to rewrite for Android and iOS. Hence what I need is some way that this JavaScript library can be used in native apps. Following two ways look promising:
WebViews: The JS files would reside locally and webview will be used to run them
NativeScript: NativeScript allows you to create native apps from JavaScript. But I didn't find anything which suggests that I can create native library too. Can this be used in any way?

You might be looking for React Native
It is a Javascript framework, and when you write your code, most of the time, you can use the same code for iOS and Android. It is a relatively new framework, but can be very powerful for rapid cross-development, but (obviously) has its trade-offs.

Related

how do i implement a google doc-like app on mobile?

I'm currently working on a project similar to google docs. Basically, it allows
multiple users to edit word documents concurently in a web browser. I've been
working extensively in pure javascript nodejs and socket.io. The web based
text editor was written from scratch using HTML5, CSS and Javascript. I handled
Operational Transformation(OT) with shareJS(server & client library that allows
realtime editing).
The challenge I'm having now is with mobile development, where I typically want
to develop for both android and iOS. I've been unsure about the right workflow and
technical decisions to make. Below is what has been going through my mind:
How do I incorporate my javascript application into a native iOS/Android app? Should
I just build an exact clone of what I have on the web from scratch? I mean build a
replica of my web implementation in iOS(Swift)/Android(Java). Of course this would mean
re-writing my text editor and OT scripts from scratch in the native language. Does that
make sense?
I know of NativeScript and phonegap. But then, when it comes to mobile, I prefer leaning
towards the native language. Is there a way to wrap my javascript into Swift/Android in
order to call my javascript functions?
Have been thinkin about this for weeks now, pondering over how to go about this. I think i need suggestions,
thoughts and advice from other frames of reference. Thanks in advance

Integrate one visualisation from d3.js in an android application

I want to develop an android application which is to integrate a visualization from d3.js. Is it possible? Can anyone explain how to do this.
D3 is a library geared towards manipulating data and rendering it into an html DOM –– either via SVG, or straight up divs or perhaps a canvas. Of course there also needs to be a JavaScript engine that can run the code. Browsers provide all those things; native apps provide none of them out of the box.
However, there are ways to build native apps that wrap a javascript engine and DOM. PhoneGap is a commonly used framework for doing so. It essentially lets you develop as if things are going to run in a browser, but they're packaged into a native app. There's a performance hit to that: It won't run as fast as a native app, and often not even as fast as the same code would run in a mobile browser. But from the user's perspective, it's installed and launched just like any native app.
That's AFAIK the only way to use d3 in a native app.

convert phonegap into steroids

I'm currently looking into the options of cross platform app development, and since we already have a working (but slow) Phonegap app we consider turning it into a steroids app. So I want to know if you can convert it without rewriting all the code. And if the speed of the steroids app will be comparable with Titanium or Xamarin, which is our goal.
I haven't used Titanium or Xamarin, but I have used Steroids.js and have absolutely loved it. From going to a vanilla PhoneGap app with jQuery Mobile to Steroids the change has been very noticeable. The different native UI elements they open up make it feel much less like a web app and more of a true hybrid app.
You wouldn't need to rewrite your code, but if you wanted to take advantage of the different features that make Steroids great then you would need to rewrite some parts. You can use the PhoneGap to Steroids guide to help you create a Steroids project with your existing code.

Do I need to learn Java to create an android app using phoneGap?

I am a web developer (PHP,javascript,html5) never created an android app with Java or any other language. My question is, do I need to learn Java to create apps for android and what should I know to create an awesome android app using phoneGap.
No unless you need at some step to code a native plugin.
But it would be useful for you to understand how phonegap works behind.
No. All you need to know are the basics of the language like including namespaces/imports, setting up some configuration files and some general familiarity with using IDEs.
You also won't need Java unless you are implementing some native functionality that is not provided by the PhoneGap API. For most simple apps a working knowledge of JavaScript, HTML and CSS will suffice.
you most probably won't need much of Java knowledge (if any), since PhoneGap applications are basically websites with (an optional) extra bit of JavaScript controlling the device
the only thing you might need Java for is when you upgrade your Cordova versions and you have some old plugins which need to update due to code deprecation

Use phonegap js to access native functionality without compiling an app?

Does anyone know if it is possible to use phonegap.js to access native functionality like the camera without compiling a mobile app? I would like to use it on a mobile-site and was curious if anyone knew of a way to do this?
If you take a look at the PhoneGap Docs for each OS it says you need to compile in order to work, so no, you cannot use it on a website to access native functionality. The camera cannot be accessed from a website, it needs to be a native app.
See this SO post for a possible workaround. I haven't tested it though. And yes, it still does require a native app to be built.
That isn't possible through any JavaScript interface.
PhoneGap is a JavaScript to native wrapper that maps JavaScript/HTML/css to the mobile platform's native SDK. Since PhoneGap is only a wrapper, a compilation step is required

Categories

Resources