11-02-2021

First Class Kotlin Support for Enterprise Java Mobile Developers

Deel dit bericht

Progress Kinvey is enabling modern Java developers to be successful using Kotlin with Kinvey via the latest updates to the Kinvey Android SDK.

When I think about Progress Kinvey, I tend to skip over its standard backend capabilities and instead focus on the value-added features it provides to me, as an app developer (going above and beyond traditional serverless providers):
• Compliance and security out of the box
• What feels like a million data connectors
• Easy enterprise authentication
• and a mighty collection of client SDKs

Speaking of those client SDKs, instead of providing one or two SDKs to cover "most" app development scenarios, Kinvey goes above and beyond to provide tailored SDKs for a variety of frameworks and platforms:
• iOS
• Android
• NativeScript
• HTML5
• REST API
• Xamarin
• Angular
• PhoneGap/Cordova
• Node.js
• .NET

So Why Kotlin?
Kotlin first appeared on the scene in 2011 and within a few years was widely embraced as a language evolution for Java developers. Features of Kotlin enable more legible code without any sacrifice in performance. This means enterprise Java mobile developers have a robust option for app development.

In fact, last year, Google announced that Kotlin is now its preferred language for Android app development!
Here is some Java code I don't understand:

static MyFragment newInstance(String arg1, String arg2) {
MyFragment fragment = new MyFragment();
Bundle arguments = new Bundle();
arguments.putString(ARG_1_KEY, arg1);
arguments.putString(ARG_2_KEY, arg2);
fragment.setArguments(arguments);
return fragment;
}

And here is the more legible equivalent in Kotlin:

companion object {
fun newInstance(arg1: String, arg2: String): MyFragment {
return MyFragment().apply {
arguments = Bundle().apply {
putString(ARG_1_KEY, arg1)
putString(ARG_2_KEY, arg2)
}
}
}
}

Android SDK Gets a Revamp
The Kinvey Android SDK has been with us for some time, nothing new about that. However, with the rising popularity of Kotlin, it became clear the team needed to modernize Kinvey's Java-based Android SDK to enable Kotlin developers to feel comfortable as well.

With the SDK codebase migrated to Kotlin, this also meant migrating existing Android sample apps to Kotlin. As of today, there are a wide variety of Android sample apps for enterprise Java mobile developers to choose from:
github.com/KinveyApps/GeoTag-Android
github.com/KinveyApps/Kitchensink-Android
github.com/KinveyApps/MICFlow-Android
github.com/KinveyApps/StatusShare-Android
github.com/KinveyApps/TestDrive-Android

Get Started with Kinvey (and Kotlin!)
You can find the complete Android SDK on Github, and to get started using it with Kinvey I'd suggest consulting the Kinvey DevCenter. What's next? Well, we'd love to hear your feedback on the new Android SDK! Feel free to submit a pull request and/or tell us how we can improve the SDK via the Kinvey developer forum. And if you haven't already, be sure to sign up for your free 30-day Progress Kinvey trial today!

Rob Lauer is Senior Manager of Developer Relations at Progress.

Partners