1.0.0 • Published 7 years ago
nativescript-mobileiron-appconnect v1.0.0
NativeScript plugin for MobileIron AppConnect
Setup
tns plugin add nativescript-mobileiron-appconnect
Platform Support
Platform | Supported | Version |
---|---|---|
iOS | Yes | iOS 8.1+ |
Dependencies
NativeScript http and fetch modules are not supported by MobileIron AppTunnel technology, but fortunately nativescript-https is.
Nativescript-HTTPS, a drop-in replacement for the default http module, easily integrate AFNetworking and okhttp3, the most reliable native networking libraries with the latest and greatest HTTPS security features.
Methods
// Call this to get your app authorized
nsappconnect.requestConfig(args: any) : void;
Events
// This will be raised when AppConnectIsReady and config is parsed
nsappconnect.on("configParsed", function(eventData){
});
Usage (app.ts)
import * as application from 'application';
import { NsAppConnect } from 'nativescript-mobileiron-appconnect';
import { Dictionary } from 'nativescript-mobileiron-appconnect';
import * as Https from 'nativescript-https';
/*
Request configuration on application.launchEvent
*/
application.on(application.launchEvent, function (args) {
let nsappconnect = new NsAppConnect();
/*
If this method is raised, the app is authorized, configuration has been parsed
and the app is ready to load resources, like making the first http call to in-premises backend
*/
nsappconnect.on("configParsed", function(eventData){
/*
A dictionary will be received containing the configuration flags
*/
let nsconfig = <Dictionary<string>>eventData.object;
console.log(eventData.eventName + ` has been raised by NsAppConnect with flag_name: ${nsconfig.Item("flag_name")}!`);
var baseUrl = "BASE_URL";
/*
When this call executes, a VPN AppTunnel will be created
routing the request through MobileIron Sentry to In-Premises backend
and sending the response back to the client app
*/
Https.request({
url: baseUrl,
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(function(response) {
console.log('Https.request response', response.content)
}).catch(function(error) {
console.error('Https.request error', error)
})
});
if (args.android) {
// For Android, application.android.context will be used.
nsappconnect.requestConfig(application.android.context);
} else if (args.ios !== undefined) {
// For iOS applications, args.ios NSDictionary (launchOptions).
nsappconnect.requestConfig(args.ios);
}
});
application.start({ moduleName: "main-page" });
Roadmap
- Android support coming soon.
Author
Contributors
- Eddy Verbruggen
- Peter Kanev - Telerik
Release Notes
1.0.0
MobileIron AppConnect support for {N} iOS applications.
License
MIT.
1.0.0
7 years ago