Passing Complex Data Through The Angular 2 Router With NativeScript

I recently wrote a tutorial for navigating a NativeScript Angular 2 application using the Angular 2 Router.  In this tutorial I demonstrated how to create a multiple page application, navigate between pages, and even pass simple string parameters between the pages during navigation.  However, what happens when the data you need to pass isn’t so simple?

We’re going to take a look at some of the ways to pass data between routes in a NativeScript application that makes use of Angular 2.

(more…)

Navigating A NativeScript App With The Angular 2 Router

Unless you want a very boring single page application, you’re going to want some form of page navigation with multiple pages available.  Previously I wrote a tutorial for navigating between routes in a vanilla JavaScript NativeScript application, but with Angular 2 in full force, it probably makes sense to demonstrate navigation with the very different Angular 2 Router component.

Anyone who has been following Angular 2 since beta knows that the navigation components have changed drastically in pretty much every release.  Anyone who has been following NativeScript and Angular 2 knows that Telerik likes to use any and all Angular 2 in its vanilla state.  This means that navigation in NativeScript Angular 2 applications has changed quite a bit over the past year.  However, with Angular 2 now in general availability (GA), the Angular 2 Router is no longer beta and should no longer be changing.

We’re going to take a look at simple navigation between two Angular 2 components in a NativeScript Android and iOS mobile application using the now stable Angular 2 Router.

(more…)

Upgrading Your Hybrid Apps To Native With NativeScript

As someone who has developed both hybrid web applications and native applications, I understand the differences and advantages each brings to the table.  While I agree that you can do some pretty neat things with a hybrid web application built with frameworks like Ionic, I no longer think it is as great of a solution as it once was.

With hybrid web frameworks like Ionic 2 and native mobile frameworks like NativeScript both using Angular 2, you have to step back and ask yourself what you’re truly getting as an advantage as of now in hybrid.  Performance is one of many reasons why native still makes more sense, and being able to use Angular 2, why wouldn’t you?

This is why I spent a lot of time creating an upgrade guide to demonstrate how to take your hybrid mobile application built with Ionic 2 and Angular 2 to native with NativeScript and Angular 2.

(more…)

Build A Time-Based One-Time Password Manager With NativeScript

Not too long ago I released a time-based one-time password manager called OTP Safe to Google Play and iTunes.  That particular application was built with Ionic Framework and I even wrote a tutorial explaining how to make a similar 2FA manager with Ionic 2.  Being a hybrid mobile application, there were some performance limitations that came with the Ionic 2 application.  This inspired me to convert the application to something native and NativeScript seemed like a solid solution.

Let's take time-based one-time password management to the next level and create a native mobile application with NativeScript and Angular.

Use Mozilla’s LocalForage For Key-Value Storage In Ionic Framework

A few years ago I wrote an article called Use ngStorage for all Your AngularJS Local Storage Needs, which was intended to be for AngularJS in general.  However, I understand many readers were using it in their hybrid Apache Cordova or Ionic Framework applications.  There is nothing wrong with this.  However, ngStorage is a wrapper for HTML5 local storage which is known to have compatibility issues under certain circumstances.  That said, came across localForage, a library by Mozilla, which claims to be a wrapper for local storage, WebSQL, and IndexedDB, offering maximum compatibility.

We’re going to take a look at including localForage in an Ionic Framework Android and iOS application for storing data.

(more…)

Build A Time-Based One-Time Password Manager With Ionic 2

A few years back I created an Android and iOS application called OTP Safe that managed time-based one-time passwords.  This application was made with the first version of Ionic Framework and at the time was great because it accomplished more than the Google Authenticator application.  Now that Ionic 2 is approaching stable release, it seemed like a cool idea to take this one-time password application and build it with the latest and greatest including Angular.

We're going to see how to create an iOS and Android time-based one-time password manager using Ionic 2, Angular, and TypeScript.

Unit Testing A NativeScript Angular 2 Android And iOS Mobile Application

Writing tests is a very important part of mobile application development, but not everyone does it.  It could be laziness, it could be because you don’t know how.  I fall into the category that I’m often too lazy to write tests.  I don’t have time to write tests, I just want my application done.  That is probably not a good answer.  Unit testing will lead to overall better applications with less problems down the road.

Not too long ago, Ben Elliot wrote a guest post on The Polyglot Developer regarding unit testing a NativeScript mobile application.  The thing is, that this was directed towards vanilla NativeScript.  While vanilla is a very valid option when it comes to NativeScript, I prefer using Angular 2 which is a bit different.

We’re going to see how to write unit tests for a NativeScript Android and iOS applications that use Angular 2 and TypeScript.

(more…)

Converting Your Ionic Framework 1 Application To Ionic 2

Ionic Framework has been around for a few years now and has completely changed the way people develop hybrid mobile applications.  With Angular out and Ionic 2 nearing stable release, the Ionic 1 and AngularJS predecessor will be a thing of the past and forgotten.  What if you've gone all in with the first version of Ionic Framework, how do you convert to the latest and greatest?

We're going to see how to take a simple Ionic Framework application and convert it to Ionic 2.  While there will be similarities, the process is manual, but better in the long run.

Use Mozilla’s LocalForage For Key-Value Storage In Ionic 2

When it comes to saving data in an Ionic 2 mobile application, there are many ways to get the job done.  You can use the classic HTML5 local storage, but run the risk of compatibility problems between all available devices.  You can use SQLite, which is part of Ionic Native, but that will only work for Android and iOS and has more of a mobile API.  You can also use SqlStorage, but that is a very proprietary solution.  This brings us to localForage from Mozilla.

Mozilla advertises localForage as a wrapper to IndexedDB, WebSQL and localStorage which will offer maximum compatibility across the grid.

We’re going to see how to include localForage in our application which is a valid option for Ionic 2.

(more…)

Using SqlStorage Instead Of SQLite In An Ionic 2 App

When it comes to Ionic 2 there are many ways that you can store your data.  For example you could use HTML5 local storage, Mozilla’s localForage library, or Ionic’s SQLite extension that is part of Ionic Native.  With these options available, I get a lot of requests for information on Ionic’s less advertised SqlStorage option.

We’re going to take a look at using SqlStorage in an Android and iOS application rather than the SQLite alternative.

(more…)