mobilefirst app ionic crashes upon tapping android button (which override app.overridebackbutton()
).
i wrote simple test app (new project, new workspace), first without ionic adding ionic references: without ionic works fine, no inherent errors in console, with ionic 2 errors:
as app starts:
"error in success callbackid: app1084986710 : error: unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (309)
when tap button (from page 2)
w/unimplementedwebviewapi(21373): unimplemented webview method onkeydown called from: android.webkit.webview.onkeydown(webview.java:2389)
updates:
if remove wl.app.overridebackbutton(goback);
, wl.app.resetbackbutton();
js functions both errors persist, , app still crashes upon tapping button.
if link/include ionic css , js remove ionic content (no ng-app property, no app.js reference index.html) button override works fine.
index.html
<!doctype html> <html style="height:100%" ng-app="mytryout" id="content"> <head> <meta charset="utf-8"> <title>tryout</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> <link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/ionic.css"> <link rel="stylesheet" href="css/ionicons.css"> <script>window.$ = window.jquery = wljq;</script> </head> <body onload="initload()"> <div id="container"> <!-- content loaded here --> </div> <script src="js/main.js"></script> <script src="js/messages.js"></script> <script src="js/initoptions.js"></script> <script src="js/ionic-bundle.js"></script> <script src="js/app.js"></script> </body> </html>
page1.html
<!doctype html> <html> <h2>page 1</h2> <button class="button button-block button-assertive" onclick="gotopage2()">go</button> </html>
page2.html
<!doctype html> <html> <h2>page 2</h2> <button class="button button-block button-assertive" onclick="goback()">back</button> </html>
main.js
function wlcommoninit(){ } function initload() { goback(); } function gotopage2() { $("#container").load("html/derp.html",function(){ console.log("i'm in page 2"); wl.app.overridebackbutton(goback); }); } function goback() { $("#container").load("html/dorp.html",function(){ console.log("i'm in page 1"); wl.app.resetbackbutton(); }); }
app.js
var mymodule = angular.module('mytryout', ['ionic']);
sorry i've been busy. i'm writing outcome of requested tests here in struggle clarity.
i tried, in order:
1 - virgin mfp app (new mf project --> run as.. --> run on mf server --> build apk)
2 - added myoverride()
function main.js , onload event body tag in index.html (see code below)
3 - virgin "hello mobile first" app references ionic source files, no ionic login (i.e. no ng-app attribute on body element)
4 - virgin "hello mobile first" app button override code (as above), references ionic source files, no ionic login (i.e. no ng-app attribute on body element).
5 - virgin "hello mobile first" app button override code (as above), references ionic source files, , ng-app attribute on body element.
in 5 cases upon starting app got these errors in logcat:
04-11 17:09:19.260: w/cordovaplugin(910): attempted send second callback id: statusbar959874445 04-11 17:09:19.260: w/cordovaplugin(910): result was: "invalid action" 04-11 17:09:19.400: i/chromium(910): [info:console(309)] "error in success callbackid: app959874446 : error: unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (309)
twice
04-11 17:09:20.300: w/cordovaplugin(910): attempted send second callback id: statusbar506640404 04-11 17:09:20.300: w/cordovaplugin(910): result was: "invalid action" 04-11 17:09:20.310: i/chromium(910): [info:console(309)] "error in success callbackid: app506640405 : error: unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (309)
and
04-11 17:09:20.380: e/androidprotocolhandler(910): unable open asset url: file:///android_asset/www/default/worklight/messages/it-it/messages.json
when tapping button following errors, in cases:
04-11 17:13:38.300: e/bd.reporter(782): can't getservice hwbdservice 04-11 17:13:38.360: w/iinputconnectionwrapper(910): showstatusicon on inactive inputconnection 04-11 17:13:38.370: w/system.err(662): java.lang.nullpointerexception: attempt invoke virtual method 'int com.huawei.lcagent.client.logcollectmanager.getusertype()' on null object reference 04-11 17:13:38.300: e/bd.reporter(782): can't getservice hwbdservice 04-11 17:18:58.680: w/unimplementedwebviewapi(2338): unimplemented webview method onkeydown called from: android.webkit.webview.onkeydown(webview.java:2389)
whenever button override implemented without ionic logic (cases 2 , 4), app behaves correctly (i.e. displays alert , doesn't exit/crash). in case 5 alert shown, app exits.
//// main.js //// function myoverride() { wl.app.overridebackbutton(function(){ alert("you pressed button!"); }); }
this looks quite straightforward reproduce anyway, i'd appreciate if test on end , see if behaves same. clearer mayhem, guess...
Comments
Post a Comment