IBM Worklight 6.2. Change default behavior for Remote disable in native apps - ibm-mobilefirst

I'm using worklight application management features from an Android native App.
I want that when in the console the application status is changed to "Access Disabled" the only option for the user will be to quit.
In the Knowledge Center and in Developer works there is documentation about how to do it:
http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.appadmin.doc/admin/t_denying_access_to_older_app_versions.html?lang=en
https://www.ibm.com/developerworks/community/blogs/worklight/entry/how_to_create_a_customized_remote_disable_behavior?lang=en
It is explained that you must set a specific value for the initOptions object used in the WL.Client.init() method.
But in the Android native API I have not found the way to set the initOptions. The init method is deprecated and it does not accept initOptions.
Also, in case of Remote Disable the ResponseListener used in the WLClient.connect(aResponseListener) is not invoked, success or failure, no method is executed. Is this working as designed? I would expect a failure or success but not nothing.
Is it possible in a native app to force the application to close in case of Remote Disable?
How could I handle this situation manually in the app?

Unfortunately I do not have an example for you, but this is the general idea.
See if you can work with it (if someone can produce an example - please do...):
You need to create your own Remote Disable challenge handler that will extend the default Worklight Remote Disable challenge handler (RemoteDisableChallengeHandler.java).
class MyRemoteDisableChallengeHandler extends WLRemoteDisableChallengeHandler
Then you need to implement your custom logic in MyRemoteDisableChallengeHandler
WLClient.registerChallengeHander(new MyRemoteDisableChallengeHandler())
This will override the original.
You'll need to create your own dialog with a Quit button.
Some additional documentation.

For handling MaM configurations, this is, when you configure the app as Lost, Stolen, etc, in the Worklight Console -> Devices tab you must install the Fix IF201408281937 (Worklight 6.2) or later.
This events are also handled with the ChallengeHandler registered for the realm "wl_remoteDisableRealm"

Related

Mobilefisrt console service notification not working

Have changed the status of my app to Active notifying in mobilefirst console, and I have tried to send custom notification message to app, but the application on device is not receiving the message sent from mobilefirst console.
In the app, we are using WL.Client.connect, and we are using adapters as well, any suggestions ?
Where can we check whether this feature is disabled in worklight?
Any mobilefirst trace that we can enable to identify the issue?
Kindly suggest.
You cannot disable the feature, it's either used (by setting the app version to Remote Notify) or not used.
The message appears only once during the application lifecycle (unless you send a different message), so make sure you didn't miss it.
Additionally, make sure that in case you have multiple versions of your app, that you are looking at the correct app version that you've sent the message to.

IBM Mobilefirst Foundation Platform 6.3 - Offline Authentication

I'm studying the new function provide by 6.3 - Offline Authentication by this document,
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/authentication-security/offline-authentication/
and I'm getting a Error from the Adapter,
it's said #78 getInfo is an object, not a function,
Any help ?
Many thanks.
Note that this is not "new functionality". The sample project simply implements one possible way to achieve offline authentication.
I have tested the application by following the below scenario and it is working OK, so you really need to actually mention what you're doing, how you're doing it, what is the scenario and what exactly is the error (copy/paste it).
Steps:
Import project to Eclipse
Start the server (servers view > play button)
Deploy adapter
Deploy project and open in Xcode, install on device
Login when online (for example, using A/A as the username/password)
Logout
Move to airplane mode
Try to login again with A/A
The application successfully logged-in in 'offline mode'.

Worklight Analytics, Native Java API, no messages in dashboard

Worklight 6.2.0
Native Worklight App on Samsung Galaxy S4, Android 4.4.2
WLAnalytics.enable();
WLAnalytics.log("some text", new org.json.JSONOBject() );
WLAnalytics.send();
// and also go on to successfully call an adapter
Analytics Dasboard shows the app version and adapter activity. Log Search does not show any application log messages and the dropdown for selecting applications shows "All Applications" only, no sign of my app.
Have I missed some initialisation step? Any other ideas?
** edited to add **
It has been suggested that we should use the method:
WLAnalytics.log("some text");
In our 6.2.0.00 CLI environment there is no such Java method.
The answer is that there a further initialisation requirement that seems to be necessary when working with a pure Native application, these are typically build using the Worklight CLI tooling.
This is the initialisation, note the call to Logger.setContext()
WLAnalytics.enable();
Logger.setContext(this);
Then this works
WLAnalytics.log("My test message2", new org.json.JSONObject());
It's worth noting that the call to WLAnalytics.send() is not necessary in normal running as typically the analytic data is buffered and sent as a piggy-back on adapter calls. However while testing a call to send() does help.
Further, if running in an environment where the Analytics WAR is on a separate machine from the Worklight Server WAR there are additional latencies. Hence testing all of this needs care.
For now, I suggest that you just use the WLAnalytics.log(String) method. There are some clear inconsistencies that need to be dealt with whether it be through documentation or code fixes.
The WL.Logger APIs were originally created to send log data to a custom adapter, which is why they take a dictionary/object for extra metadata. The data sent to the custom adapter could be read as a valid JSON object to run operations on the adapter.
The WL.Analytics APIs mimicked the WL.Logger APIs for the same purpose: parsing the JSON on a worklight adapter. The Operational analytics server came as a convenience to intercept and display some of these logs, but not all of them are being captured as you have learned.
Your questions are all valid though, as none of this is described in the documentation. In future releases, we may make use of the extra JSON object passed into the API in the Operational analytics console, but for right now they only serve their original purpose of sending the analytics to a custom adapter.

Windows Store: how to test whether specific "metro" app is installed?

Well, the title says it all. From my Windows Store (a.k.a. "Metro") application, I need to know whether some other specific application is installed on that machine. Alternatively, I want to know whether there is some application that able to handle URL of specific theme (for me its the same problem) - without launching it.
I tried to use PackageManager from Windows.Management.Deployment namespace, but it not accessible from winrt...
http://msdn.microsoft.com/en-us/library/windows/apps/windows.management.deployment.aspx
Is there any other way to do that?
Thanks!
No, there isn't any way to do it. If you want to invoke another app though - you can use a custom protocol with protocol activation to invoke an app that supports that protocol or have it installed from the store.

Wanted to enable the "Directupdate feature in the Worklight application"

We have already delivered the 1.0 version of our Worklight application. By mistake we have disabled the Direct update feature by updating the attribute "connectOnStartup = false"
We dont want to redeploy the application to markets (AppStore/GooglePlay) again, but wanted to make our users to utilize the direct update feature. We do have the access to WL server.
Our issue is little different from the one which is already discussed here "IBM Worklight - How to disable Direct Update?"
How can we provide the direct update feature to our end users without redeploying the application to AppStore/Googleplay. And just by changing the Webresources of the application.
We are using the adapters in our application but no where we are explicitly calling the "WL.Client.connect".
The Direct Update feature is always enabled by default.
You need to edit your question and explain what it is you've done in your Worklight project.
The feature will not work if:
You have set connectOnStartup:false
You are not using WL.Client.connect
You are not invoking adapters
You disabled it via the checkbox in Worklight Console
Otherwise, the feature will work, and a check for Direct Update will be performed:
On application startup
On return to foreground
The application will need Re-deployment on the App stores.
So the solution to your problem is
Rebuild the Application with connectOnStartup:true.
Redeploy the Application on App Stores
Once the users download the updated application, future updates will go to the users directly.
While rebuilding, make sure that you change the Version of your application within ApplicationDescriptor.