This is a migrated thread and some comments may be shown as answers.

retrieve phone number from android

1 Answer 137 Views
Android Devices
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mustapha
Top achievements
Rank 1
mustapha asked on 15 Dec 2014, 04:51 PM
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

1 Answer, 1 is accepted

Sort by
0
Zdravko
Telerik team
answered on 16 Dec 2014, 03:57 PM
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.

 
Tags
Android Devices
Asked by
mustapha
Top achievements
Rank 1
Answers by
Zdravko
Telerik team
Share this question
or