Question

I'm getting started on firefox OS phone and I need a way to make a phone call programmatically.

I was going through the updated quick start guide https://developer.mozilla.org/en-US/Apps/Quickstart and there is no mention of how I could make a call programmatically.

Is there any part of the developer documents that covers this topic?

Was it helpful?

Solution

What about this code:

var call = navigator.mozTelephony.dial('+1555332134');
call.addEventListener('connected', function() {
   call.hangUp();
});

I got this from the book "Firefox OS in Action":

http://manning.com/jongboom/FirefoxOSiA_MEAP_CH01.pdf

OTHER TIPS

If you are developing an app for Firefox OS you can not make a call programmatically even if the app is privileged. This is for security reasons, but you can use a Web Activity to launch the dialer and enter the number. Then the user can press the dial button to make the actual call. For an example of doing this see the Firefox OS Boilerplate app: https://github.com/robnyman/Firefox-OS-Boilerplate-App/blob/gh-pages/js/webapp.js#l95. For more information on Activities see: https://developer.mozilla.org/en-US/docs/Web/API/Web_Activities and https://hacks.mozilla.org/2013/01/introducing-web-activities/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top