[SOLVED] Call someone from PlayCanvas app button

Hi i have an Ar project were i need to scan a visit card and i want to know if when i press a button,
a call could be made.
I didn’t find anything on the web for the moment.

Thank you for lighting my lantern!

Are you saying that you want to initiate a standard voice call from a PlayCanvas app (on mobile)? So essentially, when pressing the button in the PlayCanvas app, the user would be switched to the phone app with the number automatically dialing?

Yes but not in an app, in Playcanvas, you were right when you modifie the title ^^

Oh it’s you who put app in the title, no i want it on the web and it open the phone app and call the number

‘Call someone from PlayCanvas’ is confusing. That suggests you want to telephone somebody who works at PlayCanvas.

i want it on the web and it open the phone app and call the number

That’s exactly what I was suggesting.

Oh okay then i rename it an if you have a best way to tell it, you’re free to change the title :upside_down_face:

Does this help:

Hi, i will look and i tell you !

Ok so i make this code :

var ButtonCallPhone = pc.createScript('buttonCallPhone');

ButtonCallPhone.attributes.add('phoneNumber', { type: 'string'});

// initialize code called once per entity
ButtonCallPhone.prototype.initialize = function() {
    var button = this.entity.button;
    this.entity.button.on('click', function(event) {
    window.location.href = 'tel:' + this.phoneNumber;
    }, this);

// update code called every frame
ButtonCallPhone.prototype.update = function(dt) {


And it’s work well, thanks for the help !

1 Like