This question is locked. New answers and comments are not allowed.
How do you get a phone number from the device using Icenium? We are going to use this as some authentication for our app. I know it can be kind of tricky sometimes, but is there a way to do this with Icenium?
Thanks
Carlos Mosqueda
Thanks
Carlos Mosqueda
14 Answers, 1 is accepted
0
Hello Carlos,
You can use the Cordova Contacts API to get the phone number. You can clone a work in progress solution from here. It should work fine and give you a general idea of how the API is used.
Don't forget to add the necessary Android permissions mentioned in the Cordova docs.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
You can use the Cordova Contacts API to get the phone number. You can clone a work in progress solution from here. It should work fine and give you a general idea of how the API is used.
Don't forget to add the necessary Android permissions mentioned in the Cordova docs.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0

Carlos
Top achievements
Rank 1
answered on 13 Jun 2013, 10:22 PM
This will give the application the device's phone number correct?
Do you have a simple code example of the Contacts API getting the current device's phone number?
Do you have a simple code example of the Contacts API getting the current device's phone number?
0
Hi Carlos,
No, you would get any phone number from the device. Cordova does not expose direct access to the device's own phone number, but you can accomplish this through a custom plug-in. Fortunately such custom plug-in already exists (TelephoneNumberPlugin) and you can find detailed explanation how to use it in this blog post. We would introduce support for custom plug-ins in our upcoming version 1.6 expected at the end of the month.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
No, you would get any phone number from the device. Cordova does not expose direct access to the device's own phone number, but you can accomplish this through a custom plug-in. Fortunately such custom plug-in already exists (TelephoneNumberPlugin) and you can find detailed explanation how to use it in this blog post. We would introduce support for custom plug-ins in our upcoming version 1.6 expected at the end of the month.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0

Carlos
Top achievements
Rank 1
answered on 14 Jun 2013, 03:29 PM
@Steve,
From my understanding, I can not add custom plugins into an Icenium project.
I saw the plugin, but when I go to my plugins in my Icenium project, there is no way to add a custom plugin. Just the ability to add the 4 supported Cordova ( documented here) plugins that Telerik has added to the Icenium.
How would I add this or any other custom Cordova plugin into my Icenium project?
IF I am I reading the documentation correctly that I can on used the base Cordova and the 4 supported Cordova plugins. If I can add custom Cordova plugins like TelephoneNumberPlugin, do you have documentation or step by step instructions on how to add them to Icenium? Because in the plugins menu, when I go to the Add+ button, I only see the 4 supported plugins and not way to add a new one.
Thank you in advance
From my understanding, I can not add custom plugins into an Icenium project.
I saw the plugin, but when I go to my plugins in my Icenium project, there is no way to add a custom plugin. Just the ability to add the 4 supported Cordova ( documented here) plugins that Telerik has added to the Icenium.
How would I add this or any other custom Cordova plugin into my Icenium project?
IF I am I reading the documentation correctly that I can on used the base Cordova and the 4 supported Cordova plugins. If I can add custom Cordova plugins like TelephoneNumberPlugin, do you have documentation or step by step instructions on how to add them to Icenium? Because in the plugins menu, when I go to the Add+ button, I only see the 4 supported plugins and not way to add a new one.
Thank you in advance
0
Hi Carlos,
Yes, custom plug-ins are not supported in the current version, but would be in the upcoming version expected at the end of the month. I've provided this information in my previous reply in the last sentence.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
Yes, custom plug-ins are not supported in the current version, but would be in the upcoming version expected at the end of the month. I've provided this information in my previous reply in the last sentence.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0

Carlos
Top achievements
Rank 1
answered on 14 Jun 2013, 03:44 PM
Thank you for the response. I will be looking for that.
This is a great product and very thought out, just the lack of custom Cordova plug-in support was starting to be a concern.
Thanks again.
This is a great product and very thought out, just the lack of custom Cordova plug-in support was starting to be a concern.
Thanks again.
0

Carlos
Top achievements
Rank 1
answered on 01 Jul 2013, 09:34 PM
@Steve, (or anyone else from )
First off. Nice job on getting the Cordova custom plugin support released.
Secondly,
I am trying to get the TelephoneNumberPlugin to work. I tried setting up the plugin.xml since there was not one in the project. I an not quite sure I have done it all correctly. I am actually not sure I am setting the whole thing up correctly.
I am getting an alert back saying it can not find 'Uncaught module cordova/plugin/telephonenumber no found' from file://storage/sdcard0/Icenium/com.telerik_sample_app/cordova.js:48
I have attached a .txt file to show what I have going on in my files.
Any pointers or suggestions would be great.
First off. Nice job on getting the Cordova custom plugin support released.
Secondly,
I am trying to get the TelephoneNumberPlugin to work. I tried setting up the plugin.xml since there was not one in the project. I an not quite sure I have done it all correctly. I am actually not sure I am setting the whole thing up correctly.
I am getting an alert back saying it can not find 'Uncaught module cordova/plugin/telephonenumber no found' from file://storage/sdcard0/Icenium/com.telerik_sample_app/cordova.js:48
I have attached a .txt file to show what I have going on in my files.
Any pointers or suggestions would be great.
0

Carlos
Top achievements
Rank 1
answered on 01 Jul 2013, 09:41 PM
@Steve, (or anyone else from )
First off. Nice job on getting the Cordova custom plugin support released.
Secondly,
I am trying to get the TelephoneNumberPlugin to work. I tried setting up the plugin.xml since there was not one in the project. I an not quite sure I have done it all correctly. I am actually not sure I am setting the whole thing up correctly.
I am getting an alert back saying it can not find
I have attached a .jpg file to show what I have going on in my files.
Any pointers or suggestions would be great.
First off. Nice job on getting the Cordova custom plugin support released.
Secondly,
I am trying to get the TelephoneNumberPlugin to work. I tried setting up the plugin.xml since there was not one in the project. I an not quite sure I have done it all correctly. I am actually not sure I am setting the whole thing up correctly.
I am getting an alert back saying it can not find
Uncaught module cordova/plugin/telephonenumber not found
from
I have attached a .jpg file to show what I have going on in my files.
Any pointers or suggestions would be great.
0
Hi Carlos,
Your plugin.xml appears to be incorrect and it seems that plugman has failed to add the plugin to the app. Could you please try with this plugin.xml instead:
Regards,
Yavor Georgiev
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
Your plugin.xml appears to be incorrect and it seems that plugman has failed to add the plugin to the app. Could you please try with this plugin.xml instead:
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
plugin
xmlns
=
"http://www.phonegap.com/ns/plugins/1.0"
xmlns:android
=
"http://schemas.android.com/apk/res/android"
id="com.simonmacdonald.cordova.plugins.TelephoneNumber
version
=
"0.2.0"
>
<
name
>Telephone Number</
name
>
<
asset
src
=
"www/telephonenumber.js"
target
=
"telephonenumber.js"
/>
<
platform
name
=
"android"
>
<
config-file
target
=
"res/xml/config.xml"
parent
=
"plugins"
>
<
plugin
name
=
"TelephoneNumber"
value
=
"com.simonmacdonald.cordova.plugins.TelephoneNumber"
/>
</
config-file
>
<
source-file
src
=
"src/com/simonmacdonald/cordova/plugins/TelephoneNumber.java"
target-dir
=
"src/com/simonmacdonald/cordova/plugins"
/>
</
platform
>
</
plugin
>
Regards,
Yavor Georgiev
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0

Carlos
Top achievements
Rank 1
answered on 03 Jul 2013, 08:01 PM
@Yavor,
I am still getting an error saying
This error looks like it is coming from the index.html page in the .require() tag. Is there an issue with where it is looking for the plugin?
Here is what I have in my header of the index.html page.
If you see the telephonenumber.js is pointing to the root, which it is actually not. I was following the project example where the source in the script tag the telephonenumber.js has not parent path but is still in the www folder.
Is this correct?
Thanks in advance.
I am still getting an error saying
Uncaught module cordova/plugin/telephonenumber not found
from
This error looks like it is coming from the index.html page in the .require() tag. Is there an issue with where it is looking for the plugin?
Here is what I have in my header of the index.html page.
<
script
type
=
"text/javascript"
charset
=
"utf-8"
src
=
"telephonenumber.js"
></
script
>
<
script
>
//alert("hellow");
// global error handling
var showAlert = function(message, title, callback) {
alert(message, callback || function () {
}, title, 'OK');
};
var showError = function(message) {
showAlert(message, 'Error occured');
};
window.addEventListener('error', function (e) {
e.preventDefault();
var message = e.message + "' from " + e.filename + ":" + e.lineno;
showAlert(message, 'Error occured');
return true;
});
var telephoneNumber = cordova.require("cordova/plugins/telephonenumber");
telephoneNumber.get(function(result) {
console.log("result = " + result);
}, function(error) {
console.log("error = " + error.code);
});
</
script
>
If you see the telephonenumber.js is pointing to the root, which it is actually not. I was following the project example where the source in the script tag the telephonenumber.js has not parent path but is still in the www folder.
Is this correct?
Thanks in advance.
0
Hi Carlos,
You've changed this line of code:
var telephoneNumber = cordova.require("cordova/plugin/telephonenumber");
to
var telephoneNumber = cordova.require("cordova/plugins/telephonenumber");
which is wrong. The cordova.require must match the cordova.define in telephonenumber.js, which in this case is "cordova/plugin/telephonenumber". Once I've changed that, the plug-in is working correctly on my end.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
You've changed this line of code:
var telephoneNumber = cordova.require("cordova/plugin/telephonenumber");
to
var telephoneNumber = cordova.require("cordova/plugins/telephonenumber");
which is wrong. The cordova.require must match the cordova.define in telephonenumber.js, which in this case is "cordova/plugin/telephonenumber". Once I've changed that, the plug-in is working correctly on my end.
Regards,
Steve
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0

Carlos
Top achievements
Rank 1
answered on 05 Jul 2013, 04:44 PM
@Steve,
I changed the path from /plugins/ to /plugin/ but that did not seem to work. Still gave me the same error but with /plugin/ in it. I have attached a screen shot and a visual of my tree structure in Mist.
Is this a Cordova version issue? A plugin version issue? Or something else?
I am grateful for the help. This is probably something really small, but I appreciate all the help.
Do you have any other ideas on what this might be?
I am a big fan of Icenium and will be advocating more of it if I can understand the Plugin structure.
Thanks.
I changed the path from /plugins/ to /plugin/ but that did not seem to work. Still gave me the same error but with /plugin/ in it. I have attached a screen shot and a visual of my tree structure in Mist.
Is this a Cordova version issue? A plugin version issue? Or something else?
I am grateful for the help. This is probably something really small, but I appreciate all the help.
Do you have any other ideas on what this might be?
I am a big fan of Icenium and will be advocating more of it if I can understand the Plugin structure.
Thanks.
0

Carlos
Top achievements
Rank 1
answered on 05 Jul 2013, 06:50 PM
Nevermind. I got it. The variable and the declaration of the variable were cased differently.
I know this is written for Android, will this same plugin work for iPhone? Please say yes!
I know this is written for Android, will this same plugin work for iPhone? Please say yes!
0
Hello Carlos,
Unfortunately the iOS SDK does not provide an official way to access a device's own phone number. There is a private API that can access this value, but using it will cause Apple to reject your app when you submit it to the App Store. This means that no iOS version of this plugin can be made.
Regards,
Yavor Georgiev
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
Unfortunately the iOS SDK does not provide an official way to access a device's own phone number. There is a private API that can access this value, but using it will cause Apple to reject your app when you submit it to the App Store. This means that no iOS version of this plugin can be made.
Regards,
Yavor Georgiev
Telerik
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.