roblav96 / nativescript-telephony

A Nativescript plugin to get the device's SIM data (carrier name, mcc mnc, country code, telephonenumber, etc)
Other
22 stars 9 forks source link

Telephony is not a function #9

Open delanick opened 6 years ago

delanick commented 6 years ago

Hi, getting the above crash error when just copying your code into my app. Any idea what could be wrong? Can you provide a {N} Core JS example?

dlcole commented 5 years ago

I hit the same problem last night. I resolved it with this code:

var telephony = require("nativescript-telephony");

 if (page.android) {
              simInfoAcquired = telephony.Telephony();
            } else { // (iOS, so don't even attempt)
              simInfoAcquired = Promise.resolve({});
            }

simInfoAcquired.then((resolved) => { ...