blob: 78331b14ff5b3c096b014e5a7caaf96139517707 [file] [log] [blame]
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
var deviceReady = false;
function startBatteryInfoMonitoring() {
window.addEventListener("batterystatus", function (info) {
var batteryInfoStr = "Level = " + info.level + "%, Status: " + ((info.isPlugged) ? "Plugged" : "Unplugged");
document.getElementById('divbutton1').innerHTML = batteryInfoStr;
}, false);
}
// Initialize function called when page loading is finished
var init = function () {
console.log("init() called");
document.addEventListener("deviceready", function() {
deviceReady = true;
console.log("Device = " + device.platform + ", Version = " + device.version);
}, false);
window.setTimeout(function() {
if (!deviceReady) {
alert("Cordova initialization failed !!!");
}
}, 1000);
};
window.onload = init;