-
10 Jan 2013 11:15 PM #1
Answered: Background job (applicationDidEnterBackground)
Answered: Background job (applicationDidEnterBackground)
Hi,
Is there an iOS applicationDidEnterBackground() alternative for Sencha?
I need my app to do some job and polling while it's in background
Thank you
Jo
-
Best Answer Posted by george.m
You can use phonegap for that.
http://docs.phonegap.com/en/2.2.0/co....md.html#pause
-
11 Jan 2013 1:14 AM #2
-
11 Jan 2013 1:22 AM #3
Hi, not in Sencha but in Phonegap you can use the pause and resume events:
http://docs.phonegap.com/en/2.3.0/co....md.html#pause
-
11 Jan 2013 2:18 AM #4
-
11 Jan 2013 2:56 AM #5
Somebody has an example sending an alert while app is paused?
I loaded cordova-2.2.0.js, added onPause() method in my index.html, tried to lauch some alert() or Ext.device.Notification.... no success...
-
11 Jan 2013 3:09 AM #6
Put this in your app.js launch function:
Code:var onPause = function(){ alert(); } document.addEventListener("pause", onPause, false);
-
11 Jan 2013 3:38 AM #7
-
11 Jan 2013 3:41 AM #8
Oops sorry, I copied that from my code and forgot to change the event name. I've edited the post now.
-
11 Jan 2013 4:42 AM #9
Is it possible to do something like that? It's showing me nothing

Code:launch: function() { var onPause = function(){ alert("onPause"); Ext.device.Notification.show({ title: 'onPause', message: 'onPause', buttons: Ext.MessageBox.OKCANCEL, callback: function(button) { if (button == "ok") { console.log('Verified'); } else { console.log('Nope.'); } } }); } document.addEventListener("pause", onPause, false); // Destroy the #appLoadingIndicator element Ext.fly('appLoadingIndicator').destroy(); // Initialize the main view Ext.Viewport.add(Ext.create('App.view.Main')); }
-
11 Jan 2013 5:02 AM #10
That alert did show for me when I used your code exactly as it is, but once I reached the Ext.device.Notification code, I received an error in logcat, I consequently found a typo in the Sencha library, tut!
First, make sure you require the following in your app.js:
'Ext.device.Device',
'Ext.device.Notification',
'Ext.MessageBox'.
If you're using Sencha Touch v2.1 like I am (You can check your version by typing Ext.getVersion() in the console) ..
In your folder structure, go to:
touch/src/device/notification/PhoneGap.js
On line 18 for me, it read:
Which is wrong, there is a typo, it should read:Code:var ln = butons.length;
Try that.Code:var ln = buttons.length;
It seems that the typo has been resolved in 2.2.0 Alpha.


Reply With Quote