IBM Worklight : How to Fetch call logs and contacts? - ibm-mobilefirst

Am new to IBM Worklight,Is there a way to fetch the call Log and contact,like in android using TelephonyManager to track call duration,call details.Can any one know,please guide me to do fetch these details.

Worklight itself does not have access to this information. However, Worklight uses Cordova, and using Cordova you could gain this access.
To accomplish the above, you will need to create a Cordova plug-in, from which you will be able to hook into the TelephonyManager and retrieve any information that it can provide you, including call duration and details.
Creating a Cordova plug-in cannot be explained shortly, so I will link you to the training module explaining exactly this: Adding native functionality to hybrid applications with Apache Cordova.
Also, in the following question I have code written that enables hooking to the TelephonyMananger to get a different type of information, so you should be able to modify it to get what you need: IBM Worklight - Unable to get network signal strength in Android

Related

Tool to remotely log (debug) React Native production app

Is there some tool available for React Native to remotely debug or send logs from production app to me?
I want to use it to track what errors my test users getting without them need to interact with app.
Have you thought about raygun? This gives you an api to log your errors and then a portal to view them. I use it on a project at work and it's worth looking at https://raygun.com/
There are a few options for you which will be quite easy for you to implement. The first one I would suggest you is react-native-firebase and use it for pushing events to the analytics in firebase.
The second option would be react-native-flurry-sdk offered by yahoo flurry analytics which is also very easy and efficient.
If your app is on google play store already then you can use the build in crash reporting system which reports most of the errors but if you need something specific and in your own control like if you want the app to send you a specific error etc then its best to use react-native-flurry-sdk. you can get it from here:
https://github.com/flurry/react-native-flurry-sdk

In adapter calling from native android app

I am using android studio for developing my android app. SO i created a native API using the worklight 7.1.0 and copied all the jar files to the lib folder and wlclient.properties to the asset folder. So after that i have a set of adapter deployed in my company server, which i have to invoke from native code. So i changed all the values in the wlclient.properties as per the adapter required to call.
I added a listener for the connect and tried connect , it gave a Unexpected error.
I added a listener for invoking the adapter and tried connect, it gave a Application is not found in the server, couldnt register client
You only provided your explanation, and not any real example... so that's not helping to understand the real culprit here.
What I can say is:
So i changed all the values in the wlclient.properties as per the adapter required to call.
What you put in wlclient.properties is the server address for the client application to connect to. It does not relate to the adapter per-se. The adapter is invoked by the server once a request from the client came in.
The adapter then sends a request to what that is defined in the connectionPolicy element of its {adaptername}.xml file.
Various exceptions
Since you did not provide anything useful that can be debugged - I suggest that you will instead review the following tutorial and its sample application: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/server-side-development-category/invoking-adapter-procedures-native-android-applications/
The tutorial mentions the required steps to take in order to use the MobileFirst API in the Android app.

automate disable access for a worklight application - GadgetAppID value

I want to automate the disable access feature of my worklight application ( version :- 6.1.0.2 ) , I have created the below links referring info center links, Can any one please let me know, how can i get the value of gadgetAppID in the below mentioned urls. Also i have added the snap shot of the mysql DB.
Disable App post url below.
http://localhost:10080/AppName/console/api/applications/setAccessRule?gadgetAppId=""&action="disabled"&message="please try later”
Enable App post url below
http://localhost:10080/AppName/console/api/applications/setAccessRule?gadgetAppId=""&action="enabled"&message="please try later”
Thanks
djrekcer.
It is a bit complex in 6.1, see - http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.1.0/com.ibm.worklight.apiref.doc/admin/r_http_interface_of_the_prod_server.html (search for setAccessRule)
Starting with 6.2 there's a RESTful server API for that, see http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.apiref.doc/apiref/r_restapi_app_version_access_rule_put.html%23App-Version-Access-Rule--PUT-?lang=en

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.