Back to Blog Home
← all posts

NativeScript supports Android “M” preview

May 29, 2015 — by Lyubomir Blagoev

If you follow closely the mobile space I’m sure you’ve heard the news coming from Google I/O conference. There is a new version of their popular mobile Android OS. With this preview version, codenamed “M”, they are shipping some really nice enhancements. You can download the latest SDKs here. I will not go into details there are many news outlets that are have a pretty good reviews of all the new details there.


One of the interesting new features is the fingerprint API support. The way NativeScript is architectured allows us to support new OS very fast so in our team we were curious to see how to create a sample that uses fingerprints authentication NativeScript. I hope it will be interesting to to you too. Here is a short video of what this sample looks like:

The API for the the fingerprints authentication is in the “android.hardware.fingerprint” namespace. Here is how the code looks like:

var fingerPrintManager = activity.getSystemService(android.hardware.fingerprint.FingerprintManager.class);
 
if (!fingerPrintManager.isHardwareDetected())
{
   activity.showMessage("Fingerprint hardware not present");
}
else
{
   activity.showMessage("Fingerprint hardware is present");
}
 
if (!fingerPrintManager.hasEnrolledFingerprints())
{
   activity.showMessage("No enrolled fingerprints found");
}
else
{
   activity.showMessage("Enrolled fingerprints found");
}

 

There are many rumors what the “M“ letter stands for. We should wait for the official release which is expected in Q3 timeframe. Our team votes that “M” stands for “Milkshake”. We will wait and see :) Until then please let us know what do you think about this release and how the NativeScript team can help you out.