2017-06-10 3 views
4

Ich erstelle eine Anwendung für Smart-TVs mit TOAST-Projekt. Während der Entwicklung teste ich alles mit tizen emulator und tizen studio und alles war gut.Toast bauen für orsay funktioniert nicht

Nach Abschluss der Entwicklung habe ich versucht, die Anwendung auf orsay TV und orsay Emulator laufen und leider gab es eine Menge Probleme in dieser Plattform. Ich habe einige Probleme im Design behoben, aber ich kann das Hauptproblem nicht beheben. Wenn ich die Anwendung ausführen, gibt es eine Zeile in der Konsole, die besagt: deviceready has not fired after 5 seconds. Und ich kann keine TOAST API Funktionen verwenden.

ich ein leeres Projekt und tun genau das, was diese Seite sagen: https://github.com/Samsung/cordova-plugin-toast#prepare-to-start

Aber auch hier habe ich den gleichen Fehler. Bitte hilf mir. Hier

ist das Protokoll:

cordova/platform: orsay bootstrap BEGIN cordova.js:1365 adding proxy for NetworkStatus cordova.js:887 adding proxy for Console cordova.js:887 adding proxy for Device cordova.js:887 adding proxy for Globalization cordova.js:887 cordova/platform: orsay bootstrap END cordova.js:1460 adding proxy for toast.inputdevice cordova.js:1880 return Window cordova.js:1880 adding proxy for toast.tvwindow cordova.js:1880 return Window cordova.js:1880 adding proxy for toast.tvchannel cordova.js:1880 adding proxy for toast.tvaudiocontrol cordova.js:1880 adding proxy for toast.drminfo cordova.js:1880 adding proxy for toast.application cordova.js:1880 adding proxy for toast.Media cordova.js:1880 Failed to load resource: fail to read a resource form decryptied file file:///home/smarttv/Apps/xThreeApp/cordova_plugins.js deviceready has not fired after 5 seconds. cordova.js:1880 Channel not fired: onNativeReady cordova.js:1880 Channel not fired: onCordovaReady cordova.js:1880 Channel not fired: onCordovaConnectionReady cordova.js:1880 Channel not fired: onCordovaInfoReady cordova.js:1880

enter image description here

UPDATE:

Ok ich nur herausfinden, zwei Dinge:

  • , wenn ich die Anwendung ausführen auf dem Emulator mit Debug As/Samsung Smart Tv Emulator wird die devicereaday nicht ausgelöst, aber wenn ich die App im Emulator schließen und öffnen Sie es erneut von der App-Seite im Emulator, wird deviceready Ereignis perfekt funktionieren
  • Auch mit dem oben genannten Trick, wenn ich navigiere auf die zweite Seite, deviceready wird wieder nicht feuern! (Auch habe ich versucht, auf die aktuelle Seite zu navigieren, aber zweite attamp wird scheitern die deviceready Ereignis ausgelöst)

ich viele Verfahren versucht, auf die zweite Seite zu navigieren, aber alle haben das gleiche Ergebnis. (Ich benutze Methoden wie window.location.href = url; und window.location.replace(url); und ...)

+0

haben Sie schon versucht, diese - https://github.com/Samsung/cordova-plugin-toast/issues/17? – Gandhi

+0

@Gandhi Es hat das gleiche Problem, das ich in meinem Post-Update erwähne. –

Antwort

0

OK ich mich antworten, es war ein Fehler in cordova.js

um dieses Problem zu beheben, können Sie die Bootstrap-Funktion auf die folgende Quelle ändern Code in cordova.js:

bootstrap: function() { 
    console.log('cordova/platform: orsay bootstrap BEGIN'); 

    var modulemapper = require('cordova/modulemapper'); 
    var channel = require('cordova/channel'); 
    var SEF = require('cordova/plugin/SEF'); 
    var isWebapisLoaded = false; 
    var isOnShowEventFire = false; 

    modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy'); 

    var fireNativeReadyEvent = function() { 
     if(isWebapisLoaded && isOnShowEventFire) { 
      channel.onNativeReady.fire(); 
     } 
    }; 

    for (var k in define.moduleMap) { 
     if (/cordova.*\/proxy/.exec(k)) { 
      require(k); 
     } 
     if (/cordova.*\/symbols/.exec(k)) { 
      require(k); 
     } 
    } 

    var head = document.getElementsByTagName('head')[0]; 
    var script = document.createElement('script'); 
    script.type = 'text/javascript'; 
    script.src = '$MANAGER_WIDGET/Common/webapi/1.0/webapis.js'; 
    script.onload = function() { 
     isWebapisLoaded = true; 
     fireNativeReadyEvent(); 
     require('cordova/plugin/ime-via-input'); 
    }; 
    head.appendChild(script); 

    window.onPause = function() { 
     channel.onPause.fire(); 
    }; 

    window.onResume = function() { 
     channel.onResume.fire(); 
    }; 

    window.onHide = function() { 
     localStorage.clear(); 
    }; 

    window.addEventListener('load', function() { 
     var AppCommonPlugin = null; 
     var NNaviPlugin = null; 

     window.onShow = function() { 
      localStorage.setItem('showEventFlag', 'true'); 
      settingInfo(); 
     }; 

     if(localStorage.getItem('showEventFlag') == 'true') { 
      settingInfo(); 
     } 

     if(window.curWidget && typeof window.curWidget.setPreference == 'function') { 
      console.log('window.curWidget'); 
      window.curWidget.setPreference('ready', 'true'); 
     } 
    }); 

    window.addEventListener('unload', function() { 
     SEF.close(); 
    }); 

    window.addEventListener('keydown', function (e) { 
     switch(e.keyCode) { 
      case 88: // RETURN key 
       // default action disabled. 
       // Calling 'setPreference('return', 'true')' is needed explicitly to exit the application 
       e.preventDefault(); 
       break; 
      case 45: // EXIT key 
       // NOTHING to prevent. 
       break; 
     } 
    }); 

    function settingInfo() { 
     try { 
      AppCommonPlugin = SEF.get('AppCommon'); 
     } 
     catch(e) { 
      Error(e); 
     } 
     AppCommonPlugin.Execute('UnregisterAllKey'); 
     AppCommonPlugin.Execute('RegisterKey',29460); //up 
     AppCommonPlugin.Execute('RegisterKey',29461); //down 
     AppCommonPlugin.Execute('RegisterKey',4); //left 
     AppCommonPlugin.Execute('RegisterKey',5); //right 
     AppCommonPlugin.Execute('RegisterKey',29443); //enter 
     AppCommonPlugin.Execute('RegisterKey',88); // return 

     try { 
      NNaviPlugin = SEF.get('NNavi'); 
     } 
     catch(e) { 
      Error(e); 
     } 

     NNaviPlugin.Execute('SetBannerState',2); 
     isOnShowEventFire = true; 
     fireNativeReadyEvent(); 
    } 

    // End of bootstrap 
    console.log('cordova/platform: orsay bootstrap END'); 
} 

Sie weitere Details zu diesem Thema von hier finden: Toast build for orsay not working