Cordova function onDeviceReady not Working in F7


How do I use the functions used in the onDeviceReady () function in Cordova

for example:
Statusbar plugin and backbutton

function onDeviceReady() {

    StatusBar.backgroundColorByHexString("#2980b9"); //muda cor barra de status
    document.addEventListener("backbutton", onBackKeyDown, false);

everything I put in this function is not working on Framework7


Hi @Daniel_Santos,

The way you are calling/using functions inside onDeviceReady is looks fine.

document.addEventListener('deviceready', onDeviceReady, false);

Are you facing any issue on this?


They are not working


They working, otherwise you use it in a wrong way


I do not know what I’m doing wrong.

I have this files


// Dom7
var $$ = Dom7;

// Framework7 App main instance
var app = new Framework7({
    root: '#app', // App root element
    id: 'io.framework7.testapp', // App bundle ID
    name: 'Framework7', // App name
    theme: 'auto', // Automatic theme detection
    view: {
        stackPages: true, //empilhar paginas para mostrar no mesmo arquivo HTML    
        pushState: true, //voltar com o botão físico
        animateWithJS: true,       
    touch: {
        materialRipple: true,
    statusbar: {
        overlay: "auto",
        scrollTopOnClick: true,
        iosOverlaysWebView: true,
        iosTextColor: "black",
        iosBackgroundColor: null,
        materialBackgroundColor: null
    dialog: {
        buttonCancel: 'Cancelar',
    // App routes
    routes: routes,     

index.js (created for Cordova)

(function () {
    "use strict";

    function onLoad() {
        document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {
        document.addEventListener("backbutton", onBackKeyDown, false);

    function onPause() {
        // TODO: This application has been suspended. Save application state here.

    function onResume() {
        // TODO: This application has been reactivated. Restore application state here.
    function onBackKeyDown() {
        if (confirm("Deseja sair da aplicação?") == true) {



For me Its working as below.

$$(document).on('deviceready ', function(){



worked with this code

document.addEventListener('deviceready', onDeviceReady.bind(this), false);
function onDeviceReady() {   
    document.addEventListener("deviceready", onDeviceReady, false);