Tutorialsplane

Get Mobile Number in Ionic Framework


Get Mobile Number in Ionic Framework : In ionic framework you can use the DeviceInformation plugin to get the information from device. Install the cordova plugin from – https://github.com/vliesaputra/DeviceInformationPlugin. Here we are going to explain the method to get information from device such as – Get phone number, SIM card serial number etc.


Get Mobile Number in Ionic Framework

Using the https://github.com/vliesaputra/DeviceInformationPlugin plugin you can get the following information –

Below is sample code to get device information to get the desired data from the result

Get Phone Number in Ionic Framework

var deviceInformation = cordova.require("cordova/plugin/DeviceInformation");
deviceInformation .get(function(result) {
        console.log("result = " + result);
    }, function() {
        console.log("error");
    });

The above example will give you the device information such as phone number.

Note : The above plugin will work only in Android devices. It will not work on IOS platform

Ionic FAQ