MozMobileConnection.selectNetwork

  • Revision slug: DOM/MozMobileConnection.selectNetwork
  • Revision title: MozMobileConnection.selectNetwork
  • Revision id: 371029
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{ non-standard_header() }}

{{ B2GOnlyHeader2('certified') }}

Summary

The selectNetwork method is used to manually selects a network, overriding the radio's current selection.

Note: If the network is actually changed by this request, the voicechange and datachange events are fired.

Syntax

var request = navigator.mozMobileConnection.selectNetworks(network);

Parmeters

network
A {{domxref("MozMobileNetworkInfo")}} object representing the nework to select.

Return

A {{domxref("DOMRequest")}} object to handle the success or error of the method call.

If the request fails, the request's error will be either RadioNotAvailable, RequestNotSupported, IllegalSIMorME, or GenericFailure.

Example

var request = navigator.mozMobileConnection.getNetworks();

request.onsuccess = function () {
  this.result.forEach(function (networkInfo) {
    console.log(networkInfo.longName + ': ' + networkInfo.state);
  });
}

request.onerror = function () {
  console.log('operation failed: ' + this.error.name);
}

Specification

Not part of any specification.

See also

  • {{domxref("MozMobileConnection")}}
  • {{domxref("MozMobileNetworkInfo")}}
  • {{domxref("DOMRequest")}}

Revision Source

<p>{{ non-standard_header() }}</p>
<p>{{ B2GOnlyHeader2('certified') }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>selectNetwork</code> method is used to manually selects a network, overriding the radio's current selection.</p>
<div class="note">
  <p><strong>Note:</strong> If the network is actually changed by this request, the <code>voicechange</code> and <code>datachange</code> events are fired.</p>
</div>
<h2 id="Syntax">Syntax</h2>
<pre>
var request = navigator.mozMobileConnection.selectNetworks(network);</pre>
<h3>Parmeters</h3>
<dl>
  <dt>
    <code>network</code></dt>
  <dd>
    A {{domxref("MozMobileNetworkInfo")}} object representing the nework to select.</dd>
</dl>
<h3 id="Return">Return</h3>
<p>A {{domxref("DOMRequest")}} object to handle the success or error of the method call.</p>
<p>If the request fails, the request's <code>error</code> will be either <code>RadioNotAvailable</code>, <code>RequestNotSupported</code>, <code>IllegalSIMorME</code>, or <code>GenericFailure</code>.</p>
<h2 id="Example">Example</h2>
<pre class="brush: js">
var request = navigator.mozMobileConnection.getNetworks();

request.onsuccess = function () {
  this.result.forEach(function (networkInfo) {
    console.log(networkInfo.longName + ': ' + networkInfo.state);
  });
}

request.onerror = function () {
  console.log('operation failed: ' + this.error.name);
}
</pre>
<h2 id="Specification" name="Specification">Specification</h2>
<p>Not part of any specification.</p>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{domxref("MozMobileConnection")}}</li>
  <li>{{domxref("MozMobileNetworkInfo")}}</li>
  <li>{{domxref("DOMRequest")}}</li>
</ul>
Revert to this revision