IBM Worklight Offline Support - ibm-mobilefirst

we have an app which uses JSONStore to support offline, if device is offline and user submit data it stores it offline, now when device is online and when user login to the app it sync with server and submit all data to server.
the question is, Is it possible when device comes online then my offline data sync with server without user open my app ?
Does worklight support that? Or I have to do something else?
please advice

Like Idan said, Worklight does not support this, but depending on the OS, it could support it.
For instance, on Android, you could use BroadcastReceivers to detect changes in network connectivity, and execute an action when it happens, regardless of whether your app is closed or not.
Here is the API for the receiver: http://developer.android.com/reference/android/content/BroadcastReceiver.html and here is a SO answer explaining how to use it to detect WiFi connectivity: https://stackoverflow.com/a/22626736/2245921 So you can modify this BroadcastReceiver to run the sync code that you would normally do if your app was already open.
If you are using any other platform (iOS, Windows) there might be an equivalent that you can use.
Also, keep in mind that if you are doing a hybrid application, you can create your own Cordova plugin to execute native code from Javascript. Here is the documentation on how to do so: http://cordova.apache.org/docs/en/3.5.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide

Related

How to stop the user from using the app when the status is set to disabled/lost/stolen in IBM Mobilefirst console

I am using a native Android and IOS app which connects to Mobilefirst server. The app is connecting to MFP server for App authenticity and for creating user identity(Adapter authentication).
Now when I went console/devices
I see status specific to device which contains Active, Lost, Stolen, Expired and Disabled.
And under installed apps I see status Enabled and disabled. I see Certificate Serial Number value being No certificate. Do I need to add anything to get this certificate will this matter to enable or disable the status of the app.
My question is how do I use these features in Native apps?
You start by reading the documentation. You can go ahead and start reading here: http://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.monitor.doc/monitor/c_device_mgmt.html
It has nothing to do with programming so I'm not going to write anymore about this in Stack Overflow (it is too much to cover anyway).

How can i create local Notification in worklight

I'm creating an app using Worklight. I need to show a Notification at specific time like an alarm clock. It'd work when offline so i cannot use Push Notification.
I need Notification like image below. Thanks.
iOS's Local Notifications feature does not have built-in support in Worklight.
One way to add Local Notifications support is by extending your application using a Cordova plug-in, which will allow you to run Native code.
This means that you will natively implement it by following Apple's APIs: to schedule the notification in the app and to then receive a notification locally via the OS, that will in turn allow you to open the app and execute an optional callback, etc...
You could either write a custom Cordova plug-in of your own,
Or find existing plug-ins on the web.
When adding an existing Cordova plug-in to Worklight (depending on your version of Worklight and version of Cordova), the instructions to do so are a bit different at this time.
This video demonstrates one instance of how to do add an existing Cordova plug-in: Integrating Cordova plugins into Worklight applications

perform 2 way sync between online and offline databases

I'm building a webapp that has a mobile app companion. The mobile app can be used in offline mode.
What is the best way to keep the central database and the local database on the client apps in sync?
In this case, changes could be happening in the webapp and also on the local app in offline mode. How do I make sure that when a network connection is available, that both databases are in sync.
Keep in mind that the local app would only have a subset of the data. Ie.. only data pertinent to that user.
This seems like a common use case for apps. Is there an available framework for this?
Thank you.

iOS Inter App Communication in Background

There is a platform application which connects to the remote server and stores required information in its local repository, that is in CoreData. I want to develop my application over this platform app. Since it is not possible to access its local storage, I have to communicate with it somehow. I am able to send/receive data using URL Schemes; however it's frustrating for user to switch between apps constantly.
Is it possible to communicate with another application via URL Schemes (or any other way) without bringing it to foreground?
With few exceptions, such as receiving CoreLocation data in the background or being notified to wake up by a local notification, it is not possible in iOS for an application to "run in the background"
This is a pretty common query on Stack Overflow, the official iOS reply can be found here
There are SO articles here and here.
Background data exchange is however not going to be a thing as there are restrictions on background app rules (so the URL transfer is going to foreground your second app)

How to create iphone app to react as web server?

I'm working on an app, in which server (windows based) will connect to the ipad application. Then data will be transfer from the server to the ipad app. I saw different apps like PDF Expert, Wifi HD, allows server apps to connect to the iphone app through IP address. I decided to use this approach. But I don't know how to implement this. How to make the iphone/ipad app to work as a web server like the above apps do and then transfer data to them from the server side.
BTW I'll run this app on LAN. The app is not for apple's app store. So we can use private API's in it freely (If there is any for this purpose)
Anyone can help me in this regard?
Thanks
First of all, your use of terms client and server seem incorrect (if I understood you correctly). The iPad application is not a server. It is a client. If you have a Windows application as the server, then all you would need to do is have the Windows application open a socket to listen for client connections. The iPad app would connect to the server on the port that the Windows server is listening. That's just the basics of how the client/server architecture works. There's more work that needs to be done for handling disconnects, multiple clients (if you are going to allow that), and other issues.
Try CocoaHTTPServer.
I agree with zooropa, I think you want iPad to be the client, you could setup a HTTP server in windows (with a WAMP, or NIS, or whatever server you like), then in the iPad app, I would create a class to download files with NSURLConnection, check http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html for more information on how to implement a client and handle the requests.
Then when you want to download something, you use something like:
[HTTPClient downloadFile:#"http://lanserver/files/myFile.pdf" To:#"~/MyDocuments/"];
and the class would handle the request and store the file.