ldm1515
ldm1515

Reputation: 9

How to fetch and insert user's phone number in text field on visit

Goal: When the User view page, from mobile device, automatically insert his phone number in the input field, to make it easier to convert him in a lead.

Of course there will be a privacy policy etc.

It will be a promo page, where you can get an 10% discount on Burger King if you'll leave a phone number. When it's already typed-in it's a lot easier i Think.

So, can we automatically insert mobile user's phone number in text field?

If we can, what language do we have to use.

Thanks a lot.

Upvotes: 0

Views: 343

Answers (3)

syed ubaidullah
syed ubaidullah

Reputation: 1

textfield.text = CTSettingCopyMyPhoneNumber();

but first import CoreTelephony.framework

Upvotes: 0

Matt Maclennan
Matt Maclennan

Reputation: 1304

In short, it's not possible. Reason being is the same reason as to why you cannot access local files via a website. It would be a huge security and privacy issue if the browser was automatically allowed to access the local filesystem without user input.

You can ease the burden of phone number input by having masked inputs on the website in question. This article goes into quite a lot of detail regarding how to deal with telephone numbers in JavaScript. However, this is probably as close as you can get unfortunately.

Good luck!

Upvotes: 0

Logic
Logic

Reputation: 2258

Manifest

<uses-permission android:name="android.permission.READ_PHONE_STATE"/> 

Activity

TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(Context.TELEPHONY_SERVICE);
String mPhoneNumber = tMgr.getLine1Number();

Upvotes: 1

Related Questions