appVuze In-app Customer Support Plugin for PhoneGap/Cordova
Login at https://appvuze.io - manage users, applications, and support your mobile app users
Bitcode vs. No-Bitcode - please read
appVuze.framework included in this repo does not contain bitcode for space considerations. If you distribute your application via the Apple App Store with bitcode enabled, then please download appvuze-phonegap-cordova-plugin from here and unzip it on your local harddrive: https://www.dropbox.com/s/qbev5xdj7f2re3s/appvuze-phonegap-cordova-plugin-0.2.7-bitcode.zip?dl=1
Installation
Project Structure
|_hooks | |trimarch.js |plugin.xml |_src | |_android | |appVuze.gradle | |appVuzeAndroidSDK.aar | |CDVAppVuze.java | |_ios | |CDVAppVuze.h | |CDVAppVuze.m | |appVuze.framework | | |__CodeSignature | | | |CodeResources | | |appVuze | | |_Headers | | | |appVuze.h | | |Info.plist | | |_Modules | | | |module.modulemap |_www | |_appvuze.js
Usage Example. First, import plugin into your Cordova/PhoneGap app as follows:
$> cordova create AppVuzeTest$> cd AppVuzeTest$> cordova platform add ios$> cordova platform add android$> cordova plugin add appvuze, *or*$> cordova plugin add <path-to-appvuze-phonegap-cordova-plugin-with-bitcode>$> cordova prepare$> cordova build --device
Required changes to include appVuze plugin in your Cordova/PhoneGap app:
CDVAppVuze.m:
- (void)initializeSdk:(CDVInvokedUrlCommand*)command{ // Replace YOUR_APPLICATION_KEY with a key obtained from https://appvuze.io dashboard // Remember to enclose application key string in @"" [appVuze initializeSdkWithApplicationKey:YOUR_APPLICATION_KEY];}
CDVAppVuze.java:
private void executeOnUiThread(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals(ACTION_INITIALIZE_SDK)) { // Replace YOUR_APPLICATION_KEY with a key obtained from https://appvuze.io dashboard // Remember to enclose application key string in "" appVuze.initializeSdk(cordova.getActivity(), YOUR_APPLICATION_KEY); }
Index.js:
var app = { // Application Constructor initialize: function() { this.bindEvents(); }, // Bind Event Listeners // // Bind any events that are required on startup. Common events are: // 'load', 'deviceready', 'offline', and 'online'. bindEvents: function() { document.addEventListener('deviceready', this.onDeviceReady, false); }, // deviceready Event Handler // // The scope of 'this' is the event. In order to call the 'receivedEvent' // function, we must explicitly call 'app.receivedEvent(...);' onDeviceReady: function() { app.receivedEvent('deviceready'); var helpButton = document.getElementById('help-me'); helpButton.addEventListener('click', app.launchAppVuze, false); var appvuze = window.cordova.require("cordova/plugin/CDVAppVuze"); if (appvuze != null) { appvuze.initializeSdk(); } else { alert('error!'); } }, // Update DOM on a Received Event receivedEvent: function(id) { var parentElement = document.getElementById(id); var listeningElement = parentElement.querySelector('.listening'); var receivedElement = parentElement.querySelector('.received'); listeningElement.setAttribute('style', 'display:none;'); receivedElement.setAttribute('style', 'display:block;'); console.log('Received Event: ' + id); }, launchAppVuze: function() { var appvuze = window.cordova.require("cordova/plugin/CDVAppVuze"); if (appvuze != null) { appvuze.beginHelpSession('John', {accountNumber:'1234567890', userEmail:'john@doe.com'}); } else { alert('error!'); } }}; app.initialize();
Config.xml:
<feature name="AppVuze"> <param name="ios-package" value="CDVAppVuze" /></feature>
Index.html:
<!-- Customize this policy to fit your own app's needs. For more guidance, see: https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy Some notes: * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this: * Enable inline JS: add 'unsafe-inline' to default-src --> Hello World Apache Cordova Connecting to Device Device is Ready Help me!