VMware AirWatch SDK Plugin fr Apache Crdva Instructins Add AirWatch Functinality t Enterprise Applicatains with SDK Plugins v1.2 Have dcumentatin feedback? Submit a Dcumentatin Feedback supprt ticket using the Supprt Wizard n supprt.air-watch.cm. This prduct is prtected by cpyright and intellectual prperty laws in the United States and ther cuntries as well as by internatinal treaties. VMware prducts are cvered by ne r mre patents listed at http://www.vmware.cm/g/patents. VMware is a registered trademark r trademark f VMware, Inc. in the United States and ther jurisdictins. All ther marks and names mentined herein may be trademarks f their respective cmpanies. 1
Overview Use this dcument t install the VMware AirWatch SDK Plugin fr Apache Crdva. The plugin helps enterprise app develpers add enterprise-grade security, cnditinal access, and cmpliance capabilities t mbile applicatins. Supprted Cmpnents This plugin wrks with the listed cmpnent versins. Wrkspace ONE UEM cnsle v9.0+ Andrid v4.1+ ios v9.0+ Install the SDK Plugin T install the plugin, type crdva plugin add airwatch-sdk-plugin at the cmmand line. Nte: The dwnlad frm NPM, at https://www.npmjs.cm/package/airwatch-sdk-plugin, usually takes 2-3 minutes n average, ver high speed internet cnnectin. Initialize the Plugin The plugin aut-starts n bth Andrid and ios devices and it autmatically starts the Wrkspace ONE SDK. After startup, the functins are available in the windw.plugins.airwatch bject. N ther initializatin is required t use the dcumented functins. T receive events frm the SDK, initialize an event listener. See the Events sectin. Initializatin f the SDK adds the listed features t yur applicatin, depending n the cnfiguratins set in the SDK prfile in the Wrkspace ONE UEM cnsle. Applicatin level passcde Applicatin level tunneling f netwrk traffic Integrated authenticatin / single sign n Data lss preventin Disable screensht (Andrid nly) Restrict pen-in fr dcuments, web links, and email t apprved applicatins nly Restrict cpy/paste (SDK prvides flag value) Restrict access t app when device is ffline Branding f VMware Wrkspace ONE UEM splash screens when SDK applicatin is launched n device 2
Supprted Functins Use supprted functins fr Andrid and ios. setsdkeventlistener(listener) - Sets an event-handler functin t receive events frm the SDK. See the Events sectin. Call this after Crdva fires the deviceready event. The listener callback shuld have tw parameters, event and inf. username(successcallback, errrcallback) - Gets the enrlled user's username. The username is returned as a string parameter t the successcallback functin. grupid(successcallback, errrcallback) - Gets the enrlled user's grup ID. The grup ID is returned as a string parameter t the successcallback functin. servername(successcallback, errrcallback) - Gets the name f the server t which the device is enrlled. The server name is returned as a string parameter t the successcallback functin. allwcpypaste(successcallback, errrcallback) - Gets the "allw cpy/paste" setting fr the prfile. If true, then the user can cpy and paste between managed apps. If false then the user cannt cpy and paste between managed apps. The value is returned as a blean parameter t the successcallback functin. custmsettings(successcallback, errrcallback) - Gets any custm settings prvided in the app's prfile. The value is returned as a string parameter t the successcallback functin. allwoffline(successcallback, errrcallback) - Gets the "allw ffline use" setting fr the prfile. If true, then the user can use managed apps when nt cnnected t the netwrk. If false, the user cannt use managed apps when nt cnnected t the netwrk. The value is returned as a blean parameter t the successcallback functin. penfile(abslutepath, successcallback, errrcallback) - Opens the file specified by the abslute path in accrdance with the data lss preventin settings as cnfigured n the Wrkspace ONE UEM cnsle. The plugin restricts the files nly t thse whitelisted applicatins. Applicatins can have a custm implementatin using restrictdcumenttapps and allwedapplicatins APIs. A success callback is invked when the plugin is successfully able t pen the file. In all ther cases, an errr callback is invked with the crrespnding errr cde. T btain the abslute path f the file (whether the file available bundled in the app r dwnladed t the dcuments flder by the app), refer t the Crdva plugin dcumentatin, at https://crdva.apache.rg/dcs/en/latest/reference/crdva-plugin-file/. Errr cde values fr penfile 2 - File nt fund at the path 1 - Abslute path nt specified 0 - N errr SDK Events fr Applicatins The AirWatch SDK sends event ntificatins t applicatins that use it when certain cnditins arise. T receive these ntificatins in a Crdva app, call setsdkeventlistener(listener). The listener is a functin that accepts tw parameters. The first parameter is a string cntaining the name f the event. The secnd is an bject that cntains additinal data if relevant t that type f event. 3
Events fr Andrid and ios initsuccess - Sent when the AirWatch SDK is successfully initialized. All the functins f the plugin, ther than setsdkeventlistener(listener), are available after this event is fired. See the Functins sectin. initfailure - Sent when the AirWatch SDK cannt be successfully initialized. Any future calls t the plugin fail. Events fr ios wipe - Sent when the device receives a wipe instructin frm the cnsle. lck - Sent when the device receives a lck instructin frm the cnsle. unlck - Sent when the device receives an unlck instructin frm the cnsle. stpnetwrkactivity - Sent when the device receives a stpnetwrkactivity instructin frm the cnsle. The event data parameter cntains a prperty named status with a numeric value as specified in the list. Netwrk Status Values fr stpnetwrkactivity -2 - initializing -1 - nrmal 0 - bad SSID 1 - cellular data disabled 2 - raming 3 - prxy failed 4 - netwrk nt reachable resumenetwrkactivity - Sent when the device receives a resumenetwrkactivity instructin frm the cnsle. The initsuccess Event and Business Lgic Fr applicatins using the Wrkspace ONE SDK, add all business lgic f the applicatin after the SDK fires initsuccess event. This means the SDK successfully initialized and the user is authenticated successfully, if applicable. The applicatin waits until the initsuccess r initfailure event fires. Until the AirWatch SDK cmpletely lads and the initsuccess event fires, the applicatin shws a waiting screen r a lading screen t give feedback t the user that the applicaitn is in the prcess f lading and starting. The deviceready Event and Business Lgic D nt add business lgic t the deviceready event. Unless there is a specific business requirement t perfrm peratins befre the AirWatch SDK is initialized, d nt add lgic t the deviceready event. The SDK shws an authenticatin screen abve Crdva WebView which can blck the applicatin's UI until the SDK is initialized. The initfailure event fires when if SDK initializatin smehw fails. The applicatin listens t this event and shws the crrespnding errr in the applicatin. 4
Example On deviceready, please set the SDK event listener: windw.plugins.airwatch.setsdkeventlistener (sdkeventcallback). The sdkeventcallback is a functin that takes tw arguments. 1. A string that hlds the name f the event fired. 2. An bject that cntains the additinal inf n the event functin sdkeventcallback(event, inf). functin sdkeventcallback(event, inf) { /* Check (event === "initsuccess") befre using sdk functinalities */ } Questins and Feedback Let us knw if yu have any questins r feedback by emailing us at https://supprt.air-watch.cm/. 5