You've successfully subscribed to developer.school
Great! Next, complete checkout for full access to developer.school
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Making Phone Calls with Fuse

Paul Halliday
Paul Halliday

When Drake made "Hotline Bling", he was referencing a 'cell phone' which had to have had an application with phone call functionality. Let's build exactly that with Fuse.

Setup

To get started, let's make ourselves a new Fuse project.


# Create a new application
$ fuse create app PhoneCall

Now we have to add the Fuse.Launcher package to our PhoneCall.unoproj

{
  "RootNamespace":"",
  "Packages": [
    "Fuse",
    "FuseJS",
    "Fuse.Launcher"
  ],
  "Includes": [
    "*"
  ]
}
Application

I'm then adding a Button to our MainView.ux which is attached to a Clicked event, allowing us to call a phoneCall function within our JavaScript.

<App>
    <Button Clicked={phoneCall} Text="Call"></Button>
</App>

Now, we can access the Phone library and call the phone.call function. As we've exported the function, it's then in the scope of our Button's Clicked event.

<JavaScript>
    var phone = require("FuseJS/Phone");

    module.exports = {
        phoneCall: function() {
            phone.call("+447983298732");
        }
    }
</JavaScript>

You should now be able to make phone calls within your Fuse applications! :)

Paul Halliday

👋 Want to see more content? Head over to the YouTube channel: https://youtube.com/c/paulhalliday!