语言

Menu
Sites
Language
Application Become freezed and exits suddenly [Gear 2]

Hi,

I am trying to collect accelerometer data and heart rate sensor data for 3/4 hours from Gear 2. I am saving the data into IndexDB database. I have button to start and end inserting the values in database. Here is the main js file psuedocode of my app:

$(window).load(
        function() {
            flag=0
            
            $("#button1").click(function() {
    			if(flag)
				{
					flag=0;					
					$("#button1").html('Stop Inserting');
				}
				else
				{					
					flag=1;
					$("#button1").html('Start Inserting');
				}
            });
                
            window.addEventListener('devicemotion', function(e) {
                    //geting accelerometer data code here
                    if(flag)
                    {
                        //insert value into db here
                    }
			});
            window.webapis.motion.start("HRM", onchangedCB);
    		function onchangedCB(hrmInfo) 
			{
				if(hrmInfo.heartRate > 0) {
                    if(flag)
                    {
                        //insert heartrate data into database code here
                    }
				}
			}
            
    	}); // load

When I install the app and run it for the first time it works fine. But after that, when ever i run the app, and when i click button1, the app seems become freeze and exits after running for a while. I am wondering what could be the possible reason behind it. Any Idea or help on this? I appreciate your help.

Thanks, 

 

编辑者为: Sniper 07 2月, 2015

响应

2 回复
daniel kim

Hi,

In case of data storing job, such task is recommended to execute it seperately.

This link contains useful information about webworker.

https://developer.tizen.org/documentation/articles/binary-data-and-file

 

colin Rao

Did you close the HRM when you click button "Stop Inserting" or while your app in closing.