Mobile App Development Using NativeScript


In this article, we will discuss how to develop a Mobile native app using NativeScript. It is useful for those who are not very experienced in mobile app development but have good web development experience. With the use of NativeScript, developers develop a web application and after the compilation, they are able to deploy it on Angular and iOS as a Native app. The NativeScript also helps to develop a mobile app which can be deployed on iOS and Android-based mobile. So, if you want to use any native programming skill to develop the mobile app you need to know about iOS and Android development and also need to put double effort into coding as well.

Multiple platforms are available to transform a web application into a native mobile app and, NativeScript is one of them. The other options available are like ApacheCordova, react native and Ionic.  

Here, I am going to discuss NativeScript.   

First, we are going to set up the development for developing the application.

So, open the NativeScript site -

Mobile Development

NativeNativeWe does have two options to develop the mobile application.

  • Web environment
  • CLI

Web Environment 

  1. First, click “Get Started” button

    You will be able to see the below screen now,

    Mobile Development

  2. Now, if you are using an iOS or Android phone for testing your app, download Native Playground on your mobile phone and install it on your mobile.
  3. Open Native Playground on your mobile phone
  4. Scan the QR code from the mobile app
  5. You need to download and install one more app, NativeScript app Preview, on your mobile.
  6. After successful installation your web application will be connected with your mobile phone.

    This means whatever you are doing changes on your code after saving those get reflected on your mobile phone. It is very simple and there is no need to download any type of emulator for testing purpose. Within much less time our development and testing environment is ready.

    Mobile Development

Explorer Window

Mobile Development

Here we are able to see the existing application files and also we are able to add new files as per the application's requirement.

Component Window

Mobile Development


Component window has a list of all default components in nativascript so we can drag and drop the required component in the development window.

Development Window

Mobile Development

In the main screen, we can do the actual application development.

Project Structure

The project structure is similar to Angular 2 applications. Those who are aware of Angular 2 can skip this part.

In the explore screen we can see the App folder. And in the App folder entire application files are saved.


This routing is basically helpful to redirect among multiple components.

We can create multiple components and we can import those components in this file and add them into route constants.

Please see the below code for reference,

  1. import { NgModule } from "@angular/core";  
  2. import { Routes } from "@angular/router";  
  3. import { NativeScriptRouterModule } from "nativescript-angular/router";  
  5. const routes: Routes = [  
  6.    { path: "", redirectTo: "/home", pathMatch: "full" },  
  7.    { path: "home", loadChildren: "./home/home.module#HomeModule" }  
  8. ];  
  10. @NgModule({  
  11.    imports: [NativeScriptRouterModule.forRoot(routes)],  
  12.    exports: [NativeScriptRouterModule]  
  13. })  
  14. export class AppRoutingModule { }  


This is default html page. We can add html code or can drag the components from component window.

Find the below default code,

  1. <page-router-outlet></page-router-outlet>  

This code is for embedding the selected component code through routes. You can remove that and add your own functionality for better understanding.


The codebehind part is for the UI component. All required functionality is going to write here. Also we can call rest api from component also. So that we can retrieve or save data on server from our app.

The default code is below,

  1. import { Component } from "@angular/core";  
  3. @Component({  
  4.    selector: "ns-app",  
  5.    templateUrl: "app.component.html"  
  6. })  
  7. export class AppComponent { }  

We can write construct on this and and declare any variable with some default data and display it in html.

Run the application

Press the “Preview” button then you can see the actual mobile app on your mobile. 

Mobile Development

Build and deploy

One can go through the below url and easily publish the app on Google Play Store for Android here.

For ioS follow the below link :


To develop NativeScript app we have one more option, installing CLI on your local machine.

The NativeScript CLI is available for installing as an npm package.

In the command prompt, run the following command.

Operating systemscommands
Windowsnpm install nativescript -g
macOSnpm install nativescript -g
LinuxSudo npm install nativescript -g

To create a new cross-platform project from the default JavaScript template, run the following command.

  • tns create MyApp

You can add target platforms to your project. To be able to build your project into an application package for a selected target platform, you need to add the platform to your project. You can target Android and iOS with NativeScript projects.

  • tns platform add android
  • tns platform add ios 
  • tns run android --emulator
  • tns run ios --emulator

Run project with Emulator

After you have prepared your project, you can build it for your target mobile platforms.

  • tns build android
  • tns build ios

For more details you can visit here.

Build and deploy

You can go through the below url and easily publish the app on the Google Playstore for Android

For ioS publish please follow the below link here.


This article was about NativeSNativecript app development. For more information please visit here.