A page that looks like a phone dial pad?


#1

Hi everyone!
I want to knock up a mock app showing a dialpad that looks as similar as possible to the dialpad of the native phone (starting with ios).
Not sure how to do the layout so it’ll look OK on all types of phone - any ideas? I hope it’s mostly a question of where to start!
Thanks…
Alex
PS - there’s a generic (non-Nativescript) example here: https://codepen.io/mattsich/pen/dYWxmN maybe I could just take most of that and pop it into my app? Could be as simple as that?


#2

As layout is concerned you could just use GridLayout and lay buttons as in example like your provided,
as for logic you could use this plugin:
https://www.npmjs.com/package/nativescript-phone
hope it helps :slight_smile:


#3

OK, need to have a play with GridLayout, then, cheers!

I’ve looked at nativescript-phone and am optimistic there. One thing that I’ve not yet worked out how to do is to get the phone number of the device that I’m running on. I was assuming that the phone plugin would have it, but it doesn’t. Neither (I think) does the sim plugin (nativescript-telephony) which is further frustrating as it appears not to work on the simulator. Perhaps the contacts plugin will do the trick, but I’m not exactly sure if “my number” is always available…


#4

Reading telephone number requires special permissions, use this plugin for that purpose.


#5

That’s the one I tried. I think my problem is with the permissions and it not working on the simulator - or maybe it does, but I’ve not enabled it?


#6

Obviously your Simulator will not have telephone information, you need to test it with real device.


#7

Well, it could emulate a real phone, but I understand :wink:
Hopefully will some action very soon now…


#8

…and yes, that works just fine! :wink: