retrieve phone number from android

2 posts, 0 answers
  1. mustapha
    mustapha avatar
    1 posts
    Member since:
    Dec 2014

    Posted 15 Dec 2014 Link to this post

    i create app in appbuilder and i want to retrieve telephone number from device, i saw application in TelephoneNumberPlugin in phonegap but i dont know how to plugin, any one can help me.
    thank you
  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 16 Dec 2014 Link to this post

    Hi Mustapha,

    Basically you can import a custom plugin by following these steps. The archive of the plugin can be found in its GitHub repository. Just click the "Download Zip" button there.

    Some older plugins does not provide a reference to the .js file so you will have to add one manually. I did a tiny change to this plugin so it adds the reference for you. Just put the code below under <platform name="android"> tag in the plugin.xml file. The file itself can be edited as described here.

    <js-module src="www/telephonenumber.js" name="telephonenumber">
            <clobbers target="cordova.plugins.telephoneNumber" />
    </js-module>

    Please take a look at the attached sample.

    One way to add the plugin to your app is to zip the TelephoneNumberPlugin-master folder located in Plugins folder and follow the import procedure from our documentation. That's all.
    But if you want to start from the scratch, download the zip from the GitHub repo and import it. Then add the code above in the plugin.xml or copy the telephonenumber.js file from plugin's folder to your root (or somewhere else) and add a reference to it in your index.html. Notice that the reference should be positioned after Cordova's one.

    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="telephonenumber.js"></script>

    Unfortunately, this plugin won't be able to obtain the phone number because some operators do not store the number in the SIM card and I hope you will have more luck with that. It didn't work on my side.
    Here is some more info on the matter: If I can be of further assistance please let me know.

    Regards,
    Zdravko
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top