How to query or access JSONStore data from native code in IBM Worklight? - ibm-mobilefirst

My app (iOS) will have a browser built in native code and the rest in Javascript using Worklight and there's a requirement to have a shared persistent database with encryption capability for both.
JSONStore seems to have all the functionality I need, but it's only available with Javascript. Is there any way I can access it in the native code?

Correct, JSONStore is only available in the hybrid (JavaScript) API. I am unable to commit to any features in upcoming releases, but I can say that have been a large number of people asking for pure native support in JSONStore. I will make sure your request gets capture as well.

The feature will be available in worklight 6.2, which is out now...

Related

About apis, on which technology I have to made apis if I am developing application in react native?

I am developing one application in react native I am new to it. So curious to know that on which platform api should be build?
Thanks
Depending on your application, there may no reason for API at all.
If you need to store data on the server then API may be build in any technology you feel comfortable with. As far as the React Native goes, it supports many ways to connect to API, including both REST and GraphQL.

Does Mobilefirst provide a provision to access web services directly?

I am developing a native android app on MobileFirst platform. Does MobileFirst provide any code to connect to a web service instead of going through adapters? This is basically only for Native Android development and not for Hybrid app.
The MobileFirst SDK only provides what is required to work with features provided by MobileFirst, such as connecting to various backends using Adapters with the added benefit of the MobileFirst security framework, and other features.
If you have a need to connect to backends not via MobileFirst, use other common client-side utilities to achieve that.
I used the following code and it worked.
WLResourceRequest request = new WLResourceRequest("Actual server path here", GET);
request.addHeader(new BasicHeader("IfAnyHeader", "here"));
request.send(new ResponseListener());
If you are using native Android, you could use volley (or similar) to call external web services or REST apis.
http://developer.android.com/training/volley/index.html
Nothing to do with MobileFirst though, all totally standard Android native coding.

Usage of already deployed REST service in mobile application using IBM Mobile First

I've published a native android application which uses a services with response in JSON format. Now, I want to develop a Hybrid application using IBM Mobile first platform. I want to use the same service here in this case also. I'm not able to findout the mechanism to do so. Anyone please suggest me some solution.
I assume that you intend to build your hybrid app using HTML, CSS and JavaScript.
You could directly call the service using standard JavaScript
XMLHttpRequest(serviceUrl)
But you probably will use some framework such as AngularJS - such frameworks really do pay off in the long run - and in which case you have nice APIs
$http.get(serviceUrl).then(doSomeWork);
However this raw JavaScript approach does not exploit the MobileFirst programming model. We tend to find that using a Mobile Gateway architectural pattern, where MobileFirst adapters act as the gateway, pays off as your application becomes more complex. The adapters provide a security model and can implement aggregation and filtering so that precious mobile bandwidth is used more efficiently.
Hence we recommend that you build adapters, as described in the links given by Idan, and then you use the MobileFirst API to call the adapters:
WL.Client.invokeProcedure( ... );
Starting MobileFirst Platform Foundation 7.0, both the JS framework (for Hybrid apps) and the Native SDK (for iOS and Android) provide REST support. You can accomplish this using either JavaScript adapters or Java adapters.
Read the following tutorials explaining how to use MFP adapters:
Server-side development
If you're interested in Java adapters as well, take a look at these videos as well:
Getting familiar with IBM MobileFirst Platform Foundation Java Adapters [Part 1]
Getting familiar with IBM MobileFirst Platform Foundation Java Adapters [Part 2]

How to implement push method in Native jsonstore app in Worklight 6.2

I was exploring recent Worklight 6.2, JSONStore in Android native is really good thing done, but I am wondering how do I implement the push functions like I used to do WOrklight JS.
I there any APIs available to achieve this or I need to to invoke the procedure manually from native app.
Take a look at the working with external data section of Knowledge Center for Worklight v6.2. It talks about getting data from an external source which commonly referred to as pull. It also talks about sending data back to said external source which is commonly referred to as push. In both the hybrid and native environments, you get to pick the transport layer. It could be invoke procedure from the adapter client-side API (Native iOS, Native Android, Hybrid) or it could be NSURLConnection (Native iOS), jQuery.ajax (Hybrid), HttpClient (Native Android) or another network API.

IBM Worklight - Any advantages for when developing a Mobile web app?

Going through the IBM Worklight product documentation,the product looks great for building hybrid or native applications. However for building mobile web (with responsive web design) what are the specific advantages one can get from worklight?
For (the) Mobile Web (environment), I don't think that at this time there is much left.
However, you do still:
get to use Worklight Adapters and its extensive integration abilities, which do make it easier to connect to various backends
use Cordova to access some device native capabilities
use the WL Client JavaScript API