</ul>
<p>Learning how to retrieve information about installed and running applications allows you to manage all the device applications from your application: </p>
- <ol>
+ <ul>
<li><p>To retrieve a list of installed applications, use the <code>getAppsInfo()</code> method of the <code>ApplicationManager</code> interface:</p>
<pre class="prettyprint">
function onListInstalledApplications(applications) {
console.log('Application context retrieved for app ' + appContext.id);
</pre></li>
<li><p>To retrieve application battery usage information, use the <code>getBatteryUsageInfo()</code> method of the <code>ApplicationManager</code> interface.</p>
- <p>In the first parameter, specify the time period you want to include in the battery usage information, starting from a specific number of days ago. If you set the parameter to <code>null</code>, the time period since the battery was last fully charged is used.</p>
+ <p>To retrieve the battery usage information for a limited time period starting from a specific number of days ago, set the number of days in the third parameter of the method. If you leave the parameter at <code>null</code>, the time period since the battery was last fully charged is used.</p>
<pre class="prettyprint">
-var batteryUsageInfoArray = tizen.application.getBatteryUsageInfo(null, 5);
-batteryUsageInfoArray.forEach(function(abuinfo) {
- console.log('ApplicationID: ' + abuinfo.appId + ', usage: ' + abuinfo.batteryUsage);
-});
+var successCallback = function(batteryUsageInfoArray) {
+ batteryUsageInfoArray.forEach(function(abuInfo) {
+ console.log('ApplicationID: ' + abuInfo.appId + ', usage: ' + abuInfo.batteryUsage);
+ });
+};
+tizen.application.getBatteryUsageInfo(successCallback);
</pre>
<p>You can expand the obtained data by calling the <code>getAppInfo()</code> method with the <code>ApplicationId</code> parameter you have received from the returned array.</p></li>
- </ol>
+ </ul>
<h2 id="manage" name="manage">Managing Applications</h2>
<th>Since</th>
</tr>
<tr>
+<td><code>http://tizen.org/feature/battery</code></td>
+ <td>Specify this key, if the application requires information on the device battery.</td>
+ <td>2.3*</td>
+ </tr>
+<tr>
<td><code>http://tizen.org/feature/convergence.d2d</code></td>
<td>Specify this key, if the application requires the Device-to-Device (D2D) Convergence feature, which provides the service to discover near-by devices and to communicate information and data to the remote devices.</td>
<td>3.0</td>
</tr>
</tbody>
</table>
+<p>* This key has been available for checking device capabilities since Tizen 2.3. It is recommended for application filtering purposes since Tizen 4.0.</p>
<p align="center" class="Table"><strong>Table: Available requirements for mobile Web W3C/HTML5 APIs</strong></p>
<table border="1" id="features">
<th>Since</th>
</tr>
<tr>
+<td><code>http://tizen.org/feature/battery</code></td>
+ <td>Specify this key, if the application requires information on the device battery.</td>
+ <td>2.3*</td>
+ </tr>
+<tr>
<td><code>http://tizen.org/feature/convergence.d2d</code></td>
<td>Specify this key, if the application requires the Device-to-Device (D2D) Convergence feature, which provides the service to discover near-by devices and to communicate information and data to the remote devices.</td>
<td>3.0</td>
</tr>
</tbody>
</table>
+<p>* This key has been available for checking device capabilities since Tizen 2.3. It is recommended for application filtering purposes since Tizen 4.0.</p>
<p align="center" class="Table"><strong>Table: Available requirements for wearable Web W3C/HTML5 APIs</strong></p>
<table border="1" id="features">
</li>
<li>2.11. <a href="#ApplicationMetaData">ApplicationMetaData</a>
</li>
-<li>2.12. <a href="#ApplicationInformationArraySuccessCallback">ApplicationInformationArraySuccessCallback</a>
+<li>2.12. <a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a>
</li>
-<li>2.13. <a href="#FindAppControlSuccessCallback">FindAppControlSuccessCallback</a>
+<li>2.13. <a href="#ApplicationInformationArraySuccessCallback">ApplicationInformationArraySuccessCallback</a>
</li>
-<li>2.14. <a href="#ApplicationContextArraySuccessCallback">ApplicationContextArraySuccessCallback</a>
+<li>2.14. <a href="#FindAppControlSuccessCallback">FindAppControlSuccessCallback</a>
</li>
-<li>2.15. <a href="#ApplicationControlDataArrayReplyCallback">ApplicationControlDataArrayReplyCallback</a>
+<li>2.15. <a href="#ApplicationContextArraySuccessCallback">ApplicationContextArraySuccessCallback</a>
</li>
-<li>2.16. <a href="#SystemEventData">SystemEventData</a>
+<li>2.16. <a href="#ApplicationControlDataArrayReplyCallback">ApplicationControlDataArrayReplyCallback</a>
</li>
-<li>2.17. <a href="#EventCallback">EventCallback</a>
+<li>2.17. <a href="#SystemEventData">SystemEventData</a>
</li>
-<li>2.18. <a href="#StatusEventCallback">StatusEventCallback</a>
+<li>2.18. <a href="#EventCallback">EventCallback</a>
</li>
-<li>2.19. <a href="#EventInfo">EventInfo</a>
+<li>2.19. <a href="#StatusEventCallback">StatusEventCallback</a>
+</li>
+<li>2.20. <a href="#EventInfo">EventInfo</a>
</li>
</ul>
</li>
-<li>3. <a href="#full-webidl">Full WebIDL</a>
+<li>3. <a href="#api-features">Related Feature</a>
+</li>
+<li>4. <a href="#full-webidl">Full WebIDL</a>
</li>
</ul>
<hr>
<div>DOMString <a href="#ApplicationManager::getAppSharedURI">getAppSharedURI</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
<div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] <a href="#ApplicationManager::getAppMetaData">getAppMetaData</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
-<div>
-<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] <a href="#ApplicationManager::getBatteryUsageInfo">getBatteryUsageInfo</a> (optional long? days, optional long? limit)</div>
+<div>void <a href="#ApplicationManager::getBatteryUsageInfo">getBatteryUsageInfo</a> (<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional long? days, optional long? limit)</div>
<div>long <a href="#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> (<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId)</div>
<div>void <a href="#ApplicationManager::removeAppStatusChangeListener">removeAppStatusChangeListener</a> (long watchId)</div>
</td>
<td></td>
</tr>
<tr>
+<td><a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a></td>
+<td><div>void <a href="#BatteryUsageInfoArraySuccessCallback::onsuccess">onsuccess</a> (<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray)</div></td>
+</tr>
+<tr>
<td><a href="#ApplicationInformationArraySuccessCallback">ApplicationInformationArraySuccessCallback</a></td>
<td><div>void <a href="#ApplicationInformationArraySuccessCallback::onsuccess">onsuccess</a> (<a href="#ApplicationInformation">ApplicationInformation</a>[] informationArray)</div></td>
</tr>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- <a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] getBatteryUsageInfo(optional long? days, optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void getBatteryUsageInfo(<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional long? days,
+ optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
</dt>
<dd>
<div class="brief">
- Returns information about battery usage per application.
+ Gets information about battery usage per application.
</div>
-<div class="synopsis"><pre class="signature prettyprint"><a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] getBatteryUsageInfo(optional long? days, optional long? limit);
+<div class="synopsis"><pre class="signature prettyprint">void getBatteryUsageInfo(<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional long? days, optional long? limit);
</pre></div>
<p><span class="version">
Since: </span>
</p>
<div class="description">
<p>
-This method returns information about battery usage collected in last <var>days</var> days.
+This method provides information about battery usage collected in last <var>days</var> days, through callback <em>successCallback</em>.
+Maximum number of retrieved objects can be set in <em>limit</em> parameter.
</p>
<p>
-If the first parameter wasn't given, this method will return information about battery usage since last charge. Last charge means the time when device was unplugged, after reaching full charge.
+If the <em>days</em> is not given, this method retrieves information about battery usage since the time the device was unplugged, after reaching full charge.
</p>
<p>
-You can also determine number of returned objects.
+The <em>ErrorCallback</em> method is launched with these error types:
</p>
+ <ul>
+ <li>
+AbortError - if any system error occurred. </li>
+ <li>
+InvalidValuesError - if any of the input parameters contains an invalid value. </li>
+ </ul>
</div>
<p><span class="privilegelevel">
Privilege level: </span>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
+<span class="name">successCallback</span>:
+ The method to call when the invocation ends successfully.
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to call when an error occurs.
+ </li>
+ <li class="param">
<span class="name">days</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- Number of days. If parameter wasn't given, method will behave as described above.
+ Number of days. If parameter was not given, method will behave as described above.
</li>
<li class="param">
<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- This parameter defines maximum count of objects <em>ApplicationBatteryUsage</em> in returned array. If parameter wasn't given, it is set to <var>30</var>.
+ This parameter defines maximum number of <em>ApplicationBatteryUsage</em> objects in an array in <em>successCallback</em> callback.
+By default, it is set to <var>30</var>.
</li>
</ul>
</div>
-<div class="returntype">
-<p><span class="return">Return value:</span></p>
- ApplicationBatteryUsage[] Array of data containing information about battery usage per application.
- </div>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul>
with error type NotSupportedError, if this feature is not supported.
</p></li>
<li class="list"><p>
- with error type InvalidValuesError, if any of the input parameters contain an invalid value.
- </p></li>
-<li class="list"><p>
with error type SecurityError, if the application does not have the privilege to call this method.
</p></li>
<li class="list"><p>
- with error type AbortError, if any system error occurred.
+ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
</p></li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var batteryUsageInfoArray = tizen.application.getBatteryUsageInfo();
-batteryUsageInfoArray.forEach(function(abuinfo)
-{
- console.log("ApplicationID: " + abuinfo.appId + ", usage: " + abuinfo.batteryUsage);
-});
-</pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var successCallback = function(batteryUsageInfoArray)
+ {
+ batteryUsageInfoArray.forEach(function(abuInfo)
+ {
+ console.log("ApplicationID: " + abuInfo.appId + ", usage: " + abuInfo.batteryUsage);
+ });
+ };
+
+ tizen.application.getBatteryUsageInfo(successCallback);
+ </pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> ApplicationID: 3gWRkEPXz5.BasicUI3, usage: 51.78
- ApplicationID: org.tizen.homescreen-efl, usage: 19.98
+ ApplicationID: org.tizen.homescreen-efl, usage: 28.72
ApplicationID: org.tizen.lockscreen, usage: 6.05
ApplicationID: org.tizen.quickpanel, usage: 4.83
- ApplicationID: org.tizen.crash-syspopup, usage: 4.46
- ApplicationID: ise-default, usage: 4.28
ApplicationID: org.tizen.indicator, usage: 3.69
ApplicationID: org.tizen.calendar.widget, usage: 1.79
ApplicationID: org.tizen.volume, usage: 1.34
<li class="attribute" id="ApplicationBatteryUsage::appId">
<span class="attrName"><span class="readonly"> readonly
</span><span class="type">ApplicationId </span><span class="name">appId</span></span><div class="brief">
- An attribute storing ID of an installed application.
+ An attribute storing ID of an application.
</div>
<p><span class="version">
Since: </span>
<li class="attribute" id="ApplicationBatteryUsage::batteryUsage">
<span class="attrName"><span class="readonly"> readonly
</span><span class="type">double </span><span class="name">batteryUsage</span></span><div class="brief">
- An attribute which stores information about battery usage of an application with ApplicationId <em>appId</em>, in percentage. Battery usage is calculated based on CPU usage per application.
+ An attribute which stores information about battery usage of an application with ApplicationId <em>appId</em>.
+Battery usage is a ratio of battery consumption of the application with ApplicationId <em>appId</em> to the total battery consumption of all applications.
+The attribute value scales from <var>0</var> to <var>1</var>, the higher value, the more battery is consumed.
</div>
<p><span class="version">
Since: </span>
</ul>
</div>
</div>
+<div class="interface" id="BatteryUsageInfoArraySuccessCallback">
+<a class="backward-compatibility-anchor" name="::Application::BatteryUsageInfoArraySuccessCallback"></a><h3>2.12. BatteryUsageInfoArraySuccessCallback</h3>
+<div class="brief">
+ This callback interface specifies a success callback that is invoked when the battery usage per application array is retrieved.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface BatteryUsageInfoArraySuccessCallback {
+ void onsuccess(<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="description">
+ <p>
+This callback interface specifies a success method with an array of
+<em>ApplicationBatteryUsage</em> objects as an input parameter. It is used in <em>ApplicationManager.getBatteryUsageInfo()</em> method.
+ </p>
+ </div>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="BatteryUsageInfoArraySuccessCallback::onsuccess">
+<a class="backward-compatibility-anchor" name="::Application::BatteryUsageInfoArraySuccessCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the asynchronous call completes successfully.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onsuccess(<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<p><span class="remark"> Remark : </span>
+ Example of usage can be find at <a href="#ApplicationManager::getBatteryUsageInfo">getBatteryUsageInfo</a> code example.
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">batteryInfoArray</span>:
+ An array of data containing information about battery usage per application.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
<div class="interface" id="ApplicationInformationArraySuccessCallback">
-<a class="backward-compatibility-anchor" name="::Application::ApplicationInformationArraySuccessCallback"></a><h3>2.12. ApplicationInformationArraySuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::ApplicationInformationArraySuccessCallback"></a><h3>2.13. ApplicationInformationArraySuccessCallback</h3>
<div class="brief">
This callback interface specifies a success callback that is invoked when the installed application list is retrieved.
</div>
</div>
</div>
<div class="interface" id="FindAppControlSuccessCallback">
-<a class="backward-compatibility-anchor" name="::Application::FindAppControlSuccessCallback"></a><h3>2.13. FindAppControlSuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::FindAppControlSuccessCallback"></a><h3>2.14. FindAppControlSuccessCallback</h3>
<div class="brief">
This callback interface specifies a success callback that is invoked when the system has finished searching applications that match a specific application control .
</div>
</div>
</div>
<div class="interface" id="ApplicationContextArraySuccessCallback">
-<a class="backward-compatibility-anchor" name="::Application::ApplicationContextArraySuccessCallback"></a><h3>2.14. ApplicationContextArraySuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::ApplicationContextArraySuccessCallback"></a><h3>2.15. ApplicationContextArraySuccessCallback</h3>
<div class="brief">
This callback interface specifies a success callback that is invoked when the list of running applications is retrieved.
</div>
</div>
</div>
<div class="interface" id="ApplicationControlDataArrayReplyCallback">
-<a class="backward-compatibility-anchor" name="::Application::ApplicationControlDataArrayReplyCallback"></a><h3>2.15. ApplicationControlDataArrayReplyCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::ApplicationControlDataArrayReplyCallback"></a><h3>2.16. ApplicationControlDataArrayReplyCallback</h3>
<div class="brief">
The ApplicationControlDataArrayReplyCallback callback specifies success callbacks that are invoked as a reply from the requested application control within the application control requester.
</div>
</div>
</div>
<div class="interface" id="SystemEventData">
-<a class="backward-compatibility-anchor" name="::Application::SystemEventData"></a><h3>2.16. SystemEventData</h3>
+<a class="backward-compatibility-anchor" name="::Application::SystemEventData"></a><h3>2.17. SystemEventData</h3>
<div class="brief">
The SystemEventData interface defines what is retrieved from the event listener.
</div>
</div>
</div>
<div class="interface" id="EventCallback">
-<a class="backward-compatibility-anchor" name="::Application::EventCallback"></a><h3>2.17. EventCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::EventCallback"></a><h3>2.18. EventCallback</h3>
<div class="brief">
The EventCallback interface specifies a callback for getting notified when a specified event occurs.
</div>
</div>
</div>
<div class="interface" id="StatusEventCallback">
-<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback"></a><h3>2.18. StatusEventCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::StatusEventCallback"></a><h3>2.19. StatusEventCallback</h3>
<div class="brief">
The StatusEventCallback interface specifies a callback for getting notified when status of the installed application has been changed.
</div>
</div>
</div>
<div class="dictionary" id="EventInfo">
-<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.19. EventInfo</h3>
+<a class="backward-compatibility-anchor" name="::Application::EventInfo"></a><h3>2.20. EventInfo</h3>
<div class="brief">
The EventInfo dictionary identifies an event with information such as event name. If it is an user event, the broadasting application's identifier is also specified.
</div>
</div>
</div>
</div>
-<h2 id="full-webidl">3. Full WebIDL</h2>
+<h2 id="api-features">3. Related Feature</h2>
+<div id="def-api-features" class="def-api-features">
+ You can check if this API is supported with <em>tizen.systeminfo.getCapability()</em> and decide enable/disable codes that need this API.
+ <div class="def-api-feature">
+<p><div class="description">
+ <p>
+To guarantee the running of the application on a device which has battery, declare the following feature requirement in the config file:
+ </p>
+ </div></p>
+<li class="feature">http://tizen.org/feature/battery</li>
+</div>
+<p></p>
+ For more information, see <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Application Filtering.</a>
+</div>
+<h2 id="full-webidl">4. Full WebIDL</h2>
<pre class="webidl prettyprint">module Application {
typedef DOMString ApplicationId;
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- <a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] getBatteryUsageInfo(optional long? days, optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void getBatteryUsageInfo(<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional long? days,
+ optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface BatteryUsageInfoArraySuccessCallback {
+ void onsuccess(<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray);
+ };
+
[Callback=FunctionOnly, NoInterfaceObject] interface ApplicationInformationArraySuccessCallback {
void onsuccess(<a href="#ApplicationInformation">ApplicationInformation</a>[] informationArray);
};
</li>
<li>2.11. <a href="#ApplicationMetaData">ApplicationMetaData</a>
</li>
-<li>2.12. <a href="#ApplicationInformationArraySuccessCallback">ApplicationInformationArraySuccessCallback</a>
+<li>2.12. <a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a>
</li>
-<li>2.13. <a href="#FindAppControlSuccessCallback">FindAppControlSuccessCallback</a>
+<li>2.13. <a href="#ApplicationInformationArraySuccessCallback">ApplicationInformationArraySuccessCallback</a>
</li>
-<li>2.14. <a href="#ApplicationContextArraySuccessCallback">ApplicationContextArraySuccessCallback</a>
+<li>2.14. <a href="#FindAppControlSuccessCallback">FindAppControlSuccessCallback</a>
</li>
-<li>2.15. <a href="#ApplicationControlDataArrayReplyCallback">ApplicationControlDataArrayReplyCallback</a>
+<li>2.15. <a href="#ApplicationContextArraySuccessCallback">ApplicationContextArraySuccessCallback</a>
</li>
-<li>2.16. <a href="#ApplicationInformationEventCallback">ApplicationInformationEventCallback</a>
+<li>2.16. <a href="#ApplicationControlDataArrayReplyCallback">ApplicationControlDataArrayReplyCallback</a>
</li>
<li>2.17. <a href="#SystemEventData">SystemEventData</a>
</li>
</li>
</ul>
</li>
-<li>3. <a href="#full-webidl">Full WebIDL</a>
+<li>3. <a href="#api-features">Related Feature</a>
+</li>
+<li>4. <a href="#full-webidl">Full WebIDL</a>
</li>
</ul>
<hr>
<div>DOMString <a href="#ApplicationManager::getAppSharedURI">getAppSharedURI</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
<div>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] <a href="#ApplicationManager::getAppMetaData">getAppMetaData</a> (optional <a href="#ApplicationId">ApplicationId</a>? id)</div>
-<div>
-<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] <a href="#ApplicationManager::getBatteryUsageInfo">getBatteryUsageInfo</a> (optional long? days, optional long? limit)</div>
+<div>void <a href="#ApplicationManager::getBatteryUsageInfo">getBatteryUsageInfo</a> (<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional long? days, optional long? limit)</div>
<div>long <a href="#ApplicationManager::addAppStatusChangeListener">addAppStatusChangeListener</a> (<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId)</div>
<div>void <a href="#ApplicationManager::removeAppStatusChangeListener">removeAppStatusChangeListener</a> (long watchId)</div>
</td>
<td></td>
</tr>
<tr>
+<td><a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a></td>
+<td></td>
+</tr>
+<tr>
<td><a href="#ApplicationControlData">ApplicationControlData</a></td>
<td></td>
</tr>
<td></td>
</tr>
<tr>
+<td><a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a></td>
+<td><div>void <a href="#BatteryUsageInfoArraySuccessCallback::onsuccess">onsuccess</a> (<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray)</div></td>
+</tr>
+<tr>
<td><a href="#ApplicationInformationArraySuccessCallback">ApplicationInformationArraySuccessCallback</a></td>
<td><div>void <a href="#ApplicationInformationArraySuccessCallback::onsuccess">onsuccess</a> (<a href="#ApplicationInformation">ApplicationInformation</a>[] informationArray)</div></td>
</tr>
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- <a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] getBatteryUsageInfo(optional long? days, optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void getBatteryUsageInfo(<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional long? days,
+ optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
</dt>
<dd>
<div class="brief">
- Returns information about battery usage per application.
+ Gets information about battery usage per application.
</div>
-<div class="synopsis"><pre class="signature prettyprint"><a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] getBatteryUsageInfo(optional long? days, optional long? limit);
+<div class="synopsis"><pre class="signature prettyprint">void getBatteryUsageInfo(<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback, optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback, optional long? days, optional long? limit);
</pre></div>
<p><span class="version">
Since: </span>
</p>
<div class="description">
<p>
-This method returns information about battery usage collected in last <var>days</var> days.
+This method provides information about battery usage collected in last <var>days</var> days, through callback <em>successCallback</em>.
+Maximum number of retrieved objects can be set in <em>limit</em> parameter.
</p>
<p>
-If the first parameter wasn't given, this method will return information about battery usage since last charge. Last charge means the time when device was unplugged, after reaching full charge.
+If the <em>days</em> is not given, this method retrieves information about battery usage since the time the device was unplugged, after reaching full charge.
</p>
<p>
-You can also determine number of returned objects.
+The <em>ErrorCallback</em> method is launched with these error types:
</p>
+ <ul>
+ <li>
+AbortError - if any system error occurred. </li>
+ <li>
+InvalidValuesError - if any of the input parameters contains an invalid value. </li>
+ </ul>
</div>
<p><span class="privilegelevel">
Privilege level: </span>
<p><span class="param">Parameters:</span></p>
<ul>
<li class="param">
+<span class="name">successCallback</span>:
+ The method to call when the invocation ends successfully.
+ </li>
+ <li class="param">
+<span class="name">errorCallback</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
+ The method to call when an error occurs.
+ </li>
+ <li class="param">
<span class="name">days</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- Number of days. If parameter wasn't given, method will behave as described above.
+ Number of days. If parameter was not given, method will behave as described above.
</li>
<li class="param">
<span class="name">limit</span><span class="optional"> [optional]</span><span class="optional"> [nullable]</span>:
- This parameter defines maximum count of objects <em>ApplicationBatteryUsage</em> in returned array. If parameter wasn't given, it is set to <var>30</var>.
+ This parameter defines maximum number of <em>ApplicationBatteryUsage</em> objects in an array in <em>successCallback</em> callback.
+By default, it is set to <var>30</var>.
</li>
</ul>
</div>
-<div class="returntype">
-<p><span class="return">Return value:</span></p>
- ApplicationBatteryUsage[] Array of data containing information about battery usage per application.
- </div>
<div class="exceptionlist">
<p><span class="except">Exceptions:</span></p>
<ul class="exception"><li>WebAPIException<ul>
with error type NotSupportedError, if this feature is not supported.
</p></li>
<li class="list"><p>
- with error type InvalidValuesError, if any of the input parameters contain an invalid value.
- </p></li>
-<li class="list"><p>
with error type SecurityError, if the application does not have the privilege to call this method.
</p></li>
<li class="list"><p>
- with error type AbortError, if any system error occurred.
+ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
</p></li>
</ul>
</li></ul>
</div>
<div class="example">
-<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint">
-var batteryUsageInfoArray = tizen.application.getBatteryUsageInfo();
-batteryUsageInfoArray.forEach(function(abuinfo) {
- console.log("ApplicationID: " + abuinfo.appId + ", usage: " + abuinfo.batteryUsage);
-});
-</pre>
+<span class="example"><p>Code example:</p></span><pre name="code" class="examplecode prettyprint"> var successCallback = function(batteryUsageInfoArray)
+ {
+ batteryUsageInfoArray.forEach(function(abuInfo)
+ {
+ console.log("ApplicationID: " + abuInfo.appId + ", usage: " + abuInfo.batteryUsage);
+ });
+ };
+
+ tizen.application.getBatteryUsageInfo(successCallback);
+ </pre>
</div>
<div class="output">
<span class="title"><p>Output example:</p></span><pre> ApplicationID: 3gWRkEPXz5.BasicUI3, usage: 51.78
- ApplicationID: org.tizen.homescreen-efl, usage: 19.98
+ ApplicationID: org.tizen.homescreen-efl, usage: 28.72
ApplicationID: org.tizen.lockscreen, usage: 6.05
ApplicationID: org.tizen.quickpanel, usage: 4.83
- ApplicationID: org.tizen.crash-syspopup, usage: 4.46
- ApplicationID: ise-default, usage: 4.28
ApplicationID: org.tizen.indicator, usage: 3.69
ApplicationID: org.tizen.calendar.widget, usage: 1.79
ApplicationID: org.tizen.volume, usage: 1.34
<li class="attribute" id="ApplicationBatteryUsage::appId">
<span class="attrName"><span class="readonly"> readonly
</span><span class="type">ApplicationId </span><span class="name">appId</span></span><div class="brief">
- An attribute storing ID of an installed application.
+ An attribute storing ID of an application.
</div>
<p><span class="version">
Since: </span>
<li class="attribute" id="ApplicationBatteryUsage::batteryUsage">
<span class="attrName"><span class="readonly"> readonly
</span><span class="type">double </span><span class="name">batteryUsage</span></span><div class="brief">
- An attribute which stores information about battery usage of an application with ApplicationId <em>appId</em>, in percentage. Battery usage is calculated based on CPU usage per application.
+ An attribute which stores information about battery usage of an application with ApplicationId <em>appId</em>.
+Battery usage is a ratio of battery consumption of the application with ApplicationId <em>appId</em> to the total battery consumption of all applications.
+The attribute value scales from <var>0</var> to <var>1</var>, the higher value, the more battery is consumed.
</div>
<p><span class="version">
Since: </span>
</ul>
</div>
</div>
+<div class="interface" id="BatteryUsageInfoArraySuccessCallback">
+<a class="backward-compatibility-anchor" name="::Application::BatteryUsageInfoArraySuccessCallback"></a><h3>2.12. BatteryUsageInfoArraySuccessCallback</h3>
+<div class="brief">
+ This callback interface specifies a success callback that is invoked when the battery usage per application array is retrieved.
+ </div>
+<pre class="webidl prettyprint"> [Callback=FunctionOnly, NoInterfaceObject] interface BatteryUsageInfoArraySuccessCallback {
+ void onsuccess(<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray);
+ };</pre>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<div class="description">
+ <p>
+This callback interface specifies a success method with an array of
+<em>ApplicationBatteryUsage</em> objects as an input parameter. It is used in <em>ApplicationManager.getBatteryUsageInfo()</em> method.
+ </p>
+ </div>
+<div class="methods">
+<h4>Methods</h4>
+<dl>
+<dt class="method" id="BatteryUsageInfoArraySuccessCallback::onsuccess">
+<a class="backward-compatibility-anchor" name="::Application::BatteryUsageInfoArraySuccessCallback::onsuccess"></a><code><b><span class="methodName">onsuccess</span></b></code>
+</dt>
+<dd>
+<div class="brief">
+ Called when the asynchronous call completes successfully.
+ </div>
+<div class="synopsis"><pre class="signature prettyprint">void onsuccess(<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray);
+ </pre></div>
+<p><span class="version">
+ Since: </span>
+ 4.0
+ </p>
+<p><span class="remark"> Remark : </span>
+ Example of usage can be find at <a href="#ApplicationManager::getBatteryUsageInfo">getBatteryUsageInfo</a> code example.
+ </p>
+<div class="parameters">
+<p><span class="param">Parameters:</span></p>
+<ul>
+ <li class="param">
+<span class="name">batteryInfoArray</span>:
+ An array of data containing information about battery usage per application.
+ </li>
+ </ul>
+</div>
+</dd>
+</dl>
+</div>
+</div>
<div class="interface" id="ApplicationInformationArraySuccessCallback">
-<a class="backward-compatibility-anchor" name="::Application::ApplicationInformationArraySuccessCallback"></a><h3>2.12. ApplicationInformationArraySuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::ApplicationInformationArraySuccessCallback"></a><h3>2.13. ApplicationInformationArraySuccessCallback</h3>
<div class="brief">
This callback interface specifies a success callback that is invoked when the installed application list is retrieved.
</div>
</div>
</div>
<div class="interface" id="FindAppControlSuccessCallback">
-<a class="backward-compatibility-anchor" name="::Application::FindAppControlSuccessCallback"></a><h3>2.13. FindAppControlSuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::FindAppControlSuccessCallback"></a><h3>2.14. FindAppControlSuccessCallback</h3>
<div class="brief">
This callback interface specifies a success callback that is invoked when the system has finished searching applications that match a specific application control .
</div>
</div>
</div>
<div class="interface" id="ApplicationContextArraySuccessCallback">
-<a class="backward-compatibility-anchor" name="::Application::ApplicationContextArraySuccessCallback"></a><h3>2.14. ApplicationContextArraySuccessCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::ApplicationContextArraySuccessCallback"></a><h3>2.15. ApplicationContextArraySuccessCallback</h3>
<div class="brief">
This callback interface specifies a success callback that is invoked when the list of running applications is retrieved.
</div>
</div>
</div>
<div class="interface" id="ApplicationControlDataArrayReplyCallback">
-<a class="backward-compatibility-anchor" name="::Application::ApplicationControlDataArrayReplyCallback"></a><h3>2.15. ApplicationControlDataArrayReplyCallback</h3>
+<a class="backward-compatibility-anchor" name="::Application::ApplicationControlDataArrayReplyCallback"></a><h3>2.16. ApplicationControlDataArrayReplyCallback</h3>
<div class="brief">
The ApplicationControlDataArrayReplyCallback callback specifies success callbacks that are invoked as a reply from the requested application control within the application control requester.
</div>
</div>
</div>
</div>
-<h2 id="full-webidl">3. Full WebIDL</h2>
+<h2 id="api-features">3. Related Feature</h2>
+<div id="def-api-features" class="def-api-features">
+ You can check if this API is supported with <em>tizen.systeminfo.getCapability()</em> and decide enable/disable codes that need this API.
+ <div class="def-api-feature">
+<p><div class="description">
+ <p>
+To guarantee the running of the application on a device which has battery, declare the following feature requirement in the config file:
+ </p>
+ </div></p>
+<li class="feature">http://tizen.org/feature/battery</li>
+</div>
+<p></p>
+ For more information, see <a href="https://developer.tizen.org/development/getting-started/web-application/understanding-tizen-programming/application-filtering">Application Filtering.</a>
+</div>
+<h2 id="full-webidl">4. Full WebIDL</h2>
<pre class="webidl prettyprint">module Application {
typedef DOMString ApplicationId;
<a href="#ApplicationMetaData">ApplicationMetaData</a>[] getAppMetaData(optional <a href="#ApplicationId">ApplicationId</a>? id) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
- <a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] getBatteryUsageInfo(optional long? days, optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
+ void getBatteryUsageInfo(<a href="#BatteryUsageInfoArraySuccessCallback">BatteryUsageInfoArraySuccessCallback</a> successCallback,
+ optional <a href="tizen.html#ErrorCallback">ErrorCallback</a>? errorCallback,
+ optional long? days,
+ optional long? limit) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
long addAppStatusChangeListener(<a href="#StatusEventCallback">StatusEventCallback</a> eventCallback, optional <a href="#ApplicationId">ApplicationId</a>? appId) raises(<a href="tizen.html#WebAPIException">WebAPIException</a>);
};
+ [Callback=FunctionOnly, NoInterfaceObject] interface BatteryUsageInfoArraySuccessCallback {
+ void onsuccess(<a href="#ApplicationBatteryUsage">ApplicationBatteryUsage</a>[] batteryInfoArray);
+ };
+
[Callback=FunctionOnly, NoInterfaceObject] interface ApplicationInformationArraySuccessCallback {
void onsuccess(<a href="#ApplicationInformation">ApplicationInformation</a>[] informationArray);
};