Hi, I am going to teach about how to make a phone call example in ionic 3 and Angular 4.
First, we want to install the Cordova and ionic Native Plugin in CLI.
$ ionic cordova plugin add call -number
$ npm install --save @ionic-native/call-number
Home.html
<ion-header>
<ion-navbar>
<ion-title>
Phone Call
</ion-title>
</ion-navbar>
</ion-header>
<ion-content fullscreen="true">
<div text-center>
<img src="assets/img/phone.png" (tap)="phone()">
</div>
</ion-content>
app.module.ts
Now we want to import the following line in app.module.ts
import { CallNumber } from '@ionic-native/call-number';
.......
.......
providers: [
....
First, we want to install the Cordova and ionic Native Plugin in CLI.
$ ionic cordova plugin add call -number
$ npm install --save @ionic-native/call-number
Home.html
<ion-header>
<ion-navbar>
<ion-title>
Phone Call
</ion-title>
</ion-navbar>
</ion-header>
<ion-content fullscreen="true">
<div text-center>
<img src="assets/img/phone.png" (tap)="phone()">
</div>
</ion-content>
app.module.ts
Now we want to import the following line in app.module.ts
import { CallNumber } from '@ionic-native/call-number';
.......
.......
providers: [
....
CallNumber,
]
Home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { CallNumber } from '@ionic-native/call-number';
@Component({
selector: 'page-home',
templateUrl: 'home.html' })
export class HomePage {
constructor(public navCtrl: NavController,public callNumber: CallNumber) {
}
phone(){
this.callNumber.callNumber("948XXXXXX3", true)
.then(() => console.log('Launched dialer!'))
.catch(() => console.log('Error launching dialer'));
}
}
how to make a phone call example in ionic 3?(android and ios)
Reviewed by Sudhan
on
October 06, 2017
Rating:
The first line of installer is 'ionic cordova plugin add call-number', there's a wrong whitespace.
ReplyDeleteThanks for the guide..
YuBac
thanks for your information.
ReplyDeletephone call api
The first line of installer is 'ionic cordova plugin add call-number', there's a wrong whitespace.
ReplyDeleteThanks for the guide..Cloud Based Dialers