Kinvey boosts enterprise mobile apps

An MBaaS (mobile back end as a service) such as FeedHenry, Kinvey, or Parse is a kind of PaaS (platform as a service) for server-backed mobile applications. Kinvey bills itself as a complete mobile and Web app platform. It has extensive client support, integrates with the major enterprise databases, and offers a back-end data store, a file store, push notifications, mobile analytics, iBeacon support, and the ability to run custom code on the back end.

According to the company, Kinvey sells to IT as its primary customer because it provides an enterprise platform, not for one or two apps but for tens and hundreds of apps for an enterprise. However, it also engages and supports the developer community app by app. Thus pricing is available for individuals and independents, as well as for smaller businesses and large enterprises.

Client support

Kinvey supports native, hybrid, and HTML5 apps. It has native toolkit support for iOS and Android. In addition, it supports HTML5, AngularJS, Backbone.js, Node.js, Apache Cordova/PhoneGap, and Appcelerator Titanium, and it provides a REST API. (PhoneGap is compatible with AngularJS 1.2.3 and later, and with all versions of Backbone.js.)

To set up a native iOS 6 or iOS 7 project to use the Kinvey back end, you need to download the KinveyKit framework, install it into your Xcode project, and set your project to link with the eight required libraries. You should also copy the KinveyKit documentation into Xcode's documentation directory. Then you'll need to import KinveyKit in your code and call [KCSClient sharedClient] initializeKinveyServiceForAppKey to connect your app with the Kinvey service, using the correct app key, app secret, and options. You can also use the Kinvey REST API in iOS projects.

To set up a native Android 2.3 or higher Kinvey project, download the latest Kinvey library and copy the JAR files into your project libs folder. To initialize the Kinvey service, instantiate a new Client.Builder(), with a kinvey.properties file present in your projects assets folder that holds the correct app key, app secret, and options.

For most HTML5 apps and JavaScript frameworks, you'll want to serve the appropriate Kinvey JavaScript library from Kinvey's content delivery network as part of your app initialization. Then you'll need to call Kinvey.init() or $kinvey.init(), depending on the framework, using the correct app key, app secret, and options.

For the REST API, you'll probably start with GET /appdata/:appKey, using basic authentication over HTTPS, to handshake with the service. The rest of your logic will need to start with a login request to collect an authorization token from the service, then all the other REST calls will use the authorization token.

Kinvey uses Promises to manage asynchronous JavaScript flows, simplifying the client code. Basically, a Promise is a proxy object for the result of an asynchronous operation. When you're ready to use the result, the then method can be called to process a successful operation, and the else method can be called to process an unsuccessful operation. Promises are currently implemented in mobile browsers and the Chrome, Firefox, and Opera desktop browsers. According to Kinvey, even the sort of enterprise that is still standardized on IE6 for its Web apps is able to use Promises in AngularJS PhoneGap apps.

Cloud code

Kinvey cloud code is written in JavaScript. In addition to using standard JavaScript and external services, it can use Kinvey APIs for logging, collection access, sending push notifications, sending email, validating requests, date and time functions, doing asynchronous processing, rendering a Mustache template, and obtaining the back-end context. Cloud code can live in hook processing functions and custom endpoints. Cloud code is versioned internally in Kinvey.

As a simple example, the following custom cloud endpoint handler responds to any request by asking for the real-time information feed for the Boston MBTA Red Line subway, parsing the JSON response, and sending that JSON to your client.

function onRequest(request,response,modules){

var req = modules.request;

req.get('http://developer.mbta.com/Data/Red.json', function(error, resp, body){

if (error){

response.body = {error: error.message};

response.complete(400);

return;

}

response.body = JSON.parse(body);

response.complete(resp.status);

});

}

Scheduled code can run against your custom endpoints. Scheduled code is commonly used to aggregate, archive, and clean up data; to pull data from a third-party API into Kinvey; or to send out a batch of emails or push notifications.

Kinvey has flexible, hook-based, back-end business logic. The hook-processing pipeline runs as follows:

Request from the client to the Kinvey back end

Authentication of the client (verify that client has access to this back end)

Pre-processing hooks

Database actions

Post-processing hooks

Clean-up and response formatting

Response returned to the requesting client

Kinvey has six hook-processing functions that you can implement:

Function (hook) When called

onPreFetch(request, response, modules) (Step 3) Called before a query or load (HTTP verb GET)

onPreSave(request, response, modules) (Step 3) Called before a save or update (HTTP verb POST or PUT)

onPreDelete(request, response, modules) (Step 3) Called before a delete (HTTP verb DELETE)

onPostFetch(request, response, modules) (Step 5) Called after a query or load (HTTP verb GET)

onPostSave(request, response, modules) Step 5) Called after a save or update (HTTP verb POST or PUT)

onPostDelete(request, response, modules) (Step 5) Called after a delete (HTTP verb DELETE)

Kinvey only guarantees that the preprocessing hooks will be called, as an error in the database actions will cause the postprocessing hooks to be skipped.

Cloud database, data links, and integrations

Kinvey implements a simple JSON key-value data store with entities and collections, using MongoDB. In the business and enterprise versions, Kinvey also has data links for Oracle, SQL Server, Salesforce, and Microsoft Dynamics CRM, plus a generic connector. The data link architecture is defined as a REST API.

Data links connect a MongoDB collection specifically marked for data integration with your database, and forward CRUD (create, read, update, and delete) requests to the database. (A few customers have used a data integration collection to cache the data for performance reasons, but mostly the data integration collection does not hold onto the data.)

Kinvey currently supports two classes of integrated services: location services like Google Places and Foursquare, and social services like Facebook Open Graph. That doesn't mean you're restricted to public APIs, but it does mean that you can't use other classes of service, except for the data and auth links we've already discussed.

Push messaging support in Kinvey requires you to perform external configuration in Google Cloud Messaging for Android or Urban Airship for iOS. Once you've done that and connected the service to your Kinvey cloud app, Kinvey takes care of all push messaging requests through its own APIs. Note that push messages will fail in the iOS emulator, but should succeed in real devices and in an Android emulator with the Google API enabled.

Kinvey handles offline data synchronization in a basic way. You can enable sync in your application initialization options and tell Kinvey when your application goes online and offline.

Kinvey.init({

appKey : 'App Key',

appSecret : 'App Secret',

sync : {

enable : true,

online : navigator.onLine // The initial application state.

}

});

// Switch application state when the on- and offline events fire.

$(window).on({

offline : Kinvey.Sync.offline,

online : Kinvey.Sync.online

});

Kinvey has an automated control setup for offline data synchronization, in which data is automatically pulled from the cache if the application is offline. If the application is online, data is pulled from the network and stored in the cache. You can turn this off and handle it yourself. You can also set important parameters such as the cache maxAge, which determines when a cached value expires and must be refreshed from the network.

Synchronization of offline data requires care in conflict resolution. Using automated control, your Kinvey app will attempt to synchronize any locally stored data when the device goes online again, but if the server data has also changed you'll have a conflict. You can set your conflict resolution policy to clientAlwaysWins, serverAlwaysWins, or a custom conflict resolution function.

Cloud deployment and management

Kinvey supports deploying on almost any cloud, including private clouds. That includes deploying to HIPAA-compliant facilities and facilities located entirely in the EU. Even Kinvey's multitenant cloud is considered secure enough for most apps, as the company does end-to-end encryption, and companies that use data links can keep their data in databases behind their own firewalls. If you have a Google App Engine server, you can link it to your Kinvey back end.

Authentication can be done internally by Kinvey, or through LDAP or Active Directory in the business and enterprise versions. Kinvey also supports Facebook, Twitter, Google+, and LinkedIn identities through OAuth.

In addition to the collection-level permissions shown in Figure 5, Kinvey supports entity-level permissions, global access control, and reader/writer lists. If you are using Kinvey's User Groups in your app, you can manage group reader/writer permissions.

The online Kinvey documentation includes guides, tutorials, samples, and references. In general, I was able to find the information I needed, but it wasn't always easy. All the documentation is organized by the client technology. That helps to keep you from being confused by seeing different notations at once, but makes it hard to compare the capabilities and samples of different clients. According to the company, most of Kinvey's users already have a favorite client technology, which means that organizing the documentation by client is the right thing to do. However, Kinvey is now developing more documentation in the form of high-level white papers and other traditional publications, to meet the expectations of enterprises.

Kinvey offers an online app cost estimator, which is designed to illustrate the development savings you can realize from using an MBaaS. If you pick all the highest-complexity choices (five client platforms, 12 pages in the app, and so on), this estimator will tell you that a DIY app would cost you about half a million dollars, while an app using Kinvey for the back end would cost about half that. Take that with a grain of salt, and look at the formulas behind the estimates before giving the results any credence.

Bearing in mind the potential savings, Kinvey's pricing is straightforward for independents and smaller businesses, starting with free and running to $1,500 per month per back end. Note that many apps can share a single back end, so this pricing is much more favorable to the customer than per-app plans. According to the company, the $1,500-per-month business plan can be considered a starting point for negotiations of enterprise plans.

Kinvey supplies basic analytics and usage metrics for users, storage, and API calls for all plans. Kinvey's Premium Analytics add-on, which I did not test, enables you to drill down from high-level aggregate analytics, through a host of different user segments, to the behaviors and actions of individual users.

Overall, Kinvey is a worthy competitor to FeedHenry for enterprises. From the perspective of an agency, independent developer, or small business, Kinvey offers reasonably priced starter plans, while FeedHenry is laser-focused on enterprise customers. Kinvey lacks the nice online drag-and-drop forms builder found in FeedHenry, but FeedHenry forms are not useful for serious, large apps -- they are mostly for simple data collection apps, such as customer surveys or site inspections.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags software

More about ApacheBackboneEUFacebookGoogleMicrosoftOraclePremiumPromise

Show Comments
[]