Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
DirkLuys
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

"App crashes at start up and make PlayBook need to be restarted"

I submitted a webworks app to the store but it keeps getting denied for the following reason: "App crashes at start up and make PlayBook need to be restarted"

 

I don't know what is wrong, my app consists of 1 HTML page with a canvas, 1 .js drawing to that canvas and some images, to be drawn on to the canvas, it worked in ripple and as a regular webpage(chrome/firefox/IE9). I don't own a playbook so I can't test the app myself and my regular PC is broken so I can't run the simulator(my other pc's are to weak)

this is my config.xml:

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.2">

  <name>Koalabr8</name>

  <description>
Navigate the koala's trough the maze
  </description>

  <rim:orientation mode="landscape"/>
  <rim:loadingScreen backgroundColor="#cccccc">

  <rim:transitionEffect type="zoomIn"/>
  </rim:loadingScreen>
		
  <rim:category name="games"/>	

  <icon src="/html5game/panda_MAINICON2.png"/>


  <author href="http://www.bavogames.tk/" rim:copyright="Copyright 2010-2012 Bavo Luysterborg">Bavo Luysterborg</author>
<content src="index.html" />
</widget>

 and this is my index.html:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta name ="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
        <meta charset="utf-8"/>

        <!-- Set the title bar of the page -->
        <title>Koalabr8</title>

        <!-- Set the background colour of the document -->
        <style>
            body {
              background: #222;
              color:#cccccc;
            }
            canvas {
                      image-rendering: optimizeSpeed;
                      -webkit-interpolation-mode: nearest-neighbor;
            }
        </style>
    </head>

    <body>
            <!-- Create the canvas element the game draws to -->
            <canvas id="canvas" width="1024" height="600">
               <p>Your browser doesn't support HTML5 canvas.</p>
            </canvas>

        <!-- Run the game code -->
        <script type="text/javascript" src="html5game/panda.js?HYFZB=1528158626"></script>
    </body>
</html>

 

:Helpsmilie: does anyone know what is causing this??

Please click the like button if my post helped you! Thank you.
Please use plain text.
Developer
DirkLuys
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: "App crashes at start up and make PlayBook need to be restarted"

I managed to fix my pc, I installed the simulator and the app works fine on playbook OS 1.0.8 and 2.0.0.

How can an app run fine on the simulator and freeze on a real playbook??

Please click the like button if my post helped you! Thank you.
Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: "App crashes at start up and make PlayBook need to be restarted"

Sorry, its not clear from the information provided what the problem is.  I expect you should get consistent behavior between the Tablet OS simulator and a live device.

 

However I suspect if a problem does exist, it is somewhere within here:

 

html5game/panda.js

 

Questions:

  1. Are you using WebGL in this file, or regular HTML5 canvas APIs?  
  2. Are you loading images from the file system?

 

I suggest using Web Inspector (in the simulator) to verify there are no runtime errors / warnings happening in your panda.js file.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
DirkLuys
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: "App crashes at start up and make PlayBook need to be restarted"

1. I don't use WebGL, only HTML5 Canvas

2. I only load images that are included with my app.

 

I will try to debug the app using webinspector now.

Please click the like button if my post helped you! Thank you.
Please use plain text.
Developer
DirkLuys
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: "App crashes at start up and make PlayBook need to be restarted"

webinspector only showed one error, I fixed it and submitted the new release. It got denied again: "When run the apps crashes at start-up and need to hard-restart the BlackBerry® PlayBook™ "

I have no idea what to do, everything works fine in the simulator and webinspector shows no errors!:Helpsmilie:

Please click the like button if my post helped you! Thank you.
Please use plain text.
Developer
DirkLuys
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: "App crashes at start up and make PlayBook need to be restarted"

I still haven't found what's wrong with my panda.js, maybe the error is in one of the two scripts panda.js calls:

 

testjs.js:

// **********************************************************************************************************************
function Deg2Rad(_deg) { return _deg * (Math.PI / 180.0); }


// #############################################################################################
/// Function:<summary>
///          	Simple function to center some text
///          </summary>
///
/// In:		<param name="_graphics">2D Graphics context</param>
/// In:		<param name="x">X coordinate</param>
///			<param name="y">Y coordinate</param>
///			<param name="colour">Colour of text</param>
///			<param name="text">text to draw!</param>
///				
// #############################################################################################
function jsDrawCenteredText(_graphics, x, y, colour, text) {
	_graphics.fillStyle = colour;
	_graphics.lineStyle = colour;
	_graphics.font = "14px Verdana"; ;
	_graphics.textAlign = "center";
	_graphics.fillText(text, x, y);
	_graphics.textAlign = "left";
}


// #############################################################################################
/// Function:<summary>
///          	Draw the "standard" loading bar!
///          </summary>
///
/// In:		<param name="_graphics">Handle to the graphics context</param>
///			<param name="_width">width of canvas</param>
///			<param name="_height">height of canvas</param>
///			<param name="_total">Total number of files being loaded</param>
///			<param name="_current">Current count to have loaded</param>
///			<param name="_loadingscreen">The loading screen "image" handle</param>
///				
// #############################################################################################
function RenderLoadingBar_Standard(_graphics, _width,_height, _total, _current, _loadingscreen) {

	// If we have a loading screen, draw that instead of the loading bar.
	if (_loadingscreen){
		_graphics.drawImage(g_LoadingScreen, 0, 0, _width, _height);
	} 
	else
	{
		var barwidth = (_width / 100) * 50;				// Loading bar 50% width of screen
		var barheight = 2;                              // Loading bar only 2 pixels high
		var x = (_width - barwidth) / 2;				// center the loading bar
		var y = 10 + (_height - barheight) / 2;			// and the move it down fro the text a little
		var w = (barwidth / _total) * _current;

		// Clear screen
		_graphics.fillStyle = "rgba(21,21,21,255)";
		_graphics.fillRect(0, 0, _width, _height);


		// Only draw the bar once "something" has loaded in.
		if (_current != 0)
		{
			// Draw the dark gray bar
			_graphics.fillStyle = "rgba(64,64,64,255)";
			_graphics.fillRect(x, y, barwidth, barheight);

			// Now draw the loaded files bar over the top.
			_graphics.fillStyle = "rgba(141,143,144,255)";
			_graphics.fillRect(x, y, w, barheight);
		}

		// Finally, draw the text.
		jsDrawCenteredText(_graphics, _width / 2, (_height / 2), "rgba(141,143,144,255)", "Loading");
	}
}




// #############################################################################################
/// Function:<summary>
///          	Draw the "standard" loading bar!
///          </summary>
///
/// In:		<param name="_graphics">Handle to the graphics context</param>
///			<param name="_width">width of canvas</param>
///			<param name="_height">height of canvas</param>
///			<param name="_total">Total number of files being loaded</param>
///			<param name="_current">Current count to have loaded</param>
///			<param name="_loadingscreen">The loading screen "image" handle</param>
///				
// #############################################################################################
function RenderLoadingBar_Custom(_graphics, _width, _height, _total, _current, _loadingscreen) {

	var segments = 270/_total;
	var total = segments*_current;
	var rad = _width;
	if( _width>_height ) rad=_height;


	// Clear screen
	_graphics.fillStyle = "rgba(112,157,213,255)";
	_graphics.strokeStyle = "rgba(0,0,0,0)";
	_graphics.fillRect(0, 0, _width, _height);

	// BLACK outline
	_graphics.beginPath();
	_graphics.lineWidth = 6;
	_graphics.strokeStyle = "rgba(0,0,0,255)";
	_graphics.arc(_width / 2, _height / 2, (rad / 4), 0, Deg2Rad(270), false);
	_graphics.stroke();


	// Gray internal
	_graphics.beginPath();
	_graphics.lineWidth = 4;
	_graphics.strokeStyle = "rgba(255,255,255,255)";
	_graphics.arc( _width/2, _height/2, (rad/4), 0, Deg2Rad(270), false);
	_graphics.stroke();

	// RED loading bar
	_graphics.beginPath();
	_graphics.lineWidth = 4;
	_graphics.strokeStyle = "rgba(255,0,0,255)";
	_graphics.arc( _width/2, _height/2, (rad/4), 0, Deg2Rad(total), false);
	_graphics.stroke();

	// Finally, draw the text. (black outline)
	var x=(_width / 2);
	var y = (_height / 2);
	_graphics.globalAlpha = 1.0;
	jsDrawCenteredText(_graphics, x,  y+1, "rgba(0,0,0,255)",       "Loading");
	jsDrawCenteredText(_graphics, x, y - 1, "rgba(0,0,0,255)", "Loading");
	jsDrawCenteredText(_graphics, x + 1, y, "rgba(0,0,0,255)", "Loading");
	jsDrawCenteredText(_graphics, x - 1, y, "rgba(0,0,0,255)", "Loading");
	jsDrawCenteredText(_graphics, x, y, "rgba(255,255,255,255)", "Loading");
}

 canvashandler.js:

function Canvassize(name, height, width) {
    var canvasmain = document.getElementById("canvasmain");
    var canvasleft = document.getElementById("canvasleft")
    var canvasright = document.getElementById("canvasright")
    var canvasbottom = document.getElementById("canvasbottom")
    name.height = height;
    name.width = width
    return true
}

 Maybe someone wants to check my panda.js manually? PM me if you want to do so.

Please click the like button if my post helped you! Thank you.
Please use plain text.
Administrator
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: "App crashes at start up and make PlayBook need to be restarted"

Sorry too much code to manually step through to be of any help.  Send me a private message if you'd like to share the source of your app and I may be able to dig deeper into any potential runtime errors.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Developer
DirkLuys
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: "App crashes at start up and make PlayBook need to be restarted"

I sent you a PM with the source.
Thanks for helping me!
Please click the like button if my post helped you! Thank you.
Please use plain text.