How I can make a call using NativeScript

Nativescript has a plugin called NativeScript-phone that helps to make a call.

To install Nativescript-phone plugin in the project, use the following command.

tns plugin add nativescript-phone

To allow your android app to make a call, you must request permission to dial. To ask permission, we need to add the following in AndroidManifest.xml

<uses-permission android:name="android.permission.CALL_PHONE" />

The following code illustrates how to make a call using nativescript-angular.

import { Component } from "@angular/core";
import * as TNSPhone  from "nativescript-phone";
@Component({
    selector: "ns-app",
    templateUrl: "./home.component.tns.html",
})
export class HomeComponent{
    MobileNo:string = '1010101010'
    makeCall(){
        TNSPhone.dial(this.MobileNo,true);
    }
}

 

 

Add comment