how-to-get-sim-information-using-ionic-phonegap

Get SIM Information using Phonegap / Apache Cordova

Want create site? Find Free WordPress Themes and plugins.
how-to-get-sim-information-using-ionic-phonegap

how-to-get-sim-information-using-ionic-phonegap

This article, we’re going to see how to get sim information using Phonegap / Apache Cordova. Using this plugin we can get following information like Carrier Name, Phone Number,  sim serial and more.

Plugin used: https://github.com/pbakondy/cordova-plugin-sim

Step By Step Guide:

  • Create a New Project / Use your existing project
  • Add you platform
  • Add Plugin
cordova plugin add cordova-plugin-sim

Use this Code:

window.plugins.sim.getSimInfo(successCallback, errorCallback);

Get SIM Information using Phonegap / Apache Cordova Full Example Code


<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>SIM</title>
 <script type="text/javascript" src="cordova.js"></script>
 <script type="text/javascript">
 document.addEventListener("deviceready",onDeviceReady,false);
 function onDeviceReady(){
 window.plugins.sim.getSimInfo(successCallback, errorCallback);
 }
 function successCallback(result) {
 document.getElementById("simInfo").innerHTML=JSON.stringify(result);
 }
function errorCallback(error) {
 document.getElementById("simInfo").innerHTML=JSON.stringify(result);
 }
 </script>
</head>
<body>
 <p id="simInfo"></p>
</body>
</html>

Output

get-sim-information-using-phonegap

get-sim-information-using-phonegap

Did you find apk for android? You can find new Free Android Games and apps.
  • Udi Shitrit

    Will apple approve the app for the store if you will get sim info?

    • You need to write Privacy & policies

      • vasagan nadar

        hi i am from tirunelveli but working in mumbai , i have a doubt, can we get a gps location of others mobile without using the server ?

        • You can use geolocation plugin

          • vasagan nadar

            can i get mobile gps location of my friends mobile without using server?

            If so how to get the location

          • Yes..!, you need to write logic

          • vasagan nadar

            i am totally blank , can you please give me some suggestions???? for ex A and B both are mobiles if i on the gps location on mobile A, the lat, lon details will be stored on A device only, so with out uploading these latitude, lon to server how can i access the details from A in B

          • You can hire me as consultant

  • Eswar Kumar

    everything is coming up. except phone number. phonenumber is blank. how to get phone number??

    • Device contact may not have a mobile number

    • Swapnil Akolkar

      if you have 2 cards
      alert(result.cards[0].phoneNumber);
      alert(result.cards[1].phoneNumber);

      for single card
      alert(result.cards[0].phoneNumber);
      working depends on telephone operator for some operators it returns blank.

  • Seung Cheol Choi

    Why did the error occur?
    ——————————————————————————–
    cannot find symbol
    ContextCompat.checkSelfPermission(this.cordova.getActivity(), type));
    ^
    symbol: method checkSelfPermission(Activity,String)
    location: class ContextCompat
    ActivityCompat.requestPermissions(this.cordova.getActivity(), new String[]{type}, 12345);
    ^
    symbol: method requestPermissions(Activity,String[],int)
    location: class ActivityCompat
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details

  • abhi

    Can you tell me how to get Imei number from the modile device using phonegap

MyMail WordPress Plugin free
Save $50 USD on Ionic Firebase Chat Source CodeEXPLORE