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

Native Development

Reply
Contributor
kozen
Posts: 13
Registered: ‎05-11-2012
My Device: BlackBerry Bold 9790
My Carrier: PCCW

BlackBerry 10 Background App

At BlackBerry 10 Jam it was mentioned that with BlackBerry 10 it is now possible to run "services" in background. Is there an how to for that available? I can't seem to find a "service" option in the latest NDK when creating a new app.

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: BlackBerry 10 Background App

Where did you hear it mentioned? I'm fairly sure that there is still no API for that, either documented or delivered in the Alpha. I'm sure it's coming, just not actually here yet.

I'd be happy to find out I'm wrong. Was this comment in one of the sessions, or just something heard in the halls?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: BlackBerry 10 Background App

Doing things in the background was mentioned a few times in DEV175, but no concrete API's were discussed.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: BlackBerry 10 Background App

I just searched the DEV175 presentation and there was only one mention of the word "background".

I think the presenters were referring to an app which was running, but may not be in the foreground.  The context of that segment seemed to be when your app isn't in the foreground, it may be impolite to go off and do some power-intensive activities.

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: BlackBerry 10 Background App

There was a lot of talk in that session about tracking the activity of a user to make intelligent guesses. For instance, if a users leaves wifi coverage around the same time each morning, he's probably starting a daily commute and may want travel info. Another example was an intelligent shopping list using location to pop up reminders. Neither of these would be practical or even possible without background tasks.

 

There are many, many use cases for background tasks. Just look at the flack IOS got for not doing it, and still gets for not doing it right.

 

I expect you'll agree that it is somewhat strange we must resort to the Android runtime to get anything resembling background tasks on PlayBook while RIM boasts about the multi-tasking capabilities of QNX...

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: BlackBerry 10 Background App

Contact the presenters and ask for clarification.  Everything you're describing would work fine today with a launched app that may not be in the foreground as far as I can tell.

Regardless, there are no such APIs yet for spawning application services.  I recognize the value in such functionality, as I'm sure everyone else does, but as I understand it, a usage model has not been formalized yet.

iOS may have got flack for it, but iOS only lets you run one app at a time.  This is not the case on PlayBook or BB10.

 

Cheers,

Sean

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: BlackBerry 10 Background App

I spoke with the presenters of DEV175, and here is the clarification I received...

 

We were hoping to give some example code for listening to whether the app window has been "backgrounded", or is not currently visible, and using the Notification API to put a flag on the home screen; to indicate to the user they should come back to the app because something noteworthy happened.

 

So the discussion was not meant to imply that an application "background service" API was available, although everyone is well aware that this is a desired feature.  They were talking about a regular app running backgrounded (eg. not fullscreen).  All doable today.

 

Cheers,

Sean

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: BlackBerry 10 Background App


smcveigh wrote:

iOS may have got flack for it, but iOS only lets you run one app at a time.  This is not the case on PlayBook or BB10.


Wow, that's very outdated info. IOS has let you run multiple apps and background tasks since IOS 4.0, two years ago. It's not the best implementation or usable for all situations, but still...

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/...

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: BlackBerry 10 Background App


smcveigh wrote:

I spoke with the presenters of DEV175, and here is the clarification I received...

[...]

So the discussion was not meant to imply that an application "background service" API was available, although everyone is well aware that this is a desired feature.  They were talking about a regular app running backgrounded (eg. not fullscreen).  All doable today.


Technically doable, yes, but not practical for the end user. It's too easy to close an app and forget to reopen it. Let's hope they sort it out soon. With a phone form factor,  4G and the new invocation framework, the need will be more prevalent than ever.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: BlackBerry 10 Background App


Innovatology wrote:

Technically doable, yes, but not practical for the end user. It's too easy to close an app and forget to reopen it.


Playing devil's advocate here.. and this is part of the reason such a facility isn't available yet...

 

The flip side of it being too easy for a user to close an app is that it is difficult or unintuitive for a user to determine how to shut down a service that has no corresponding app close button they can hit.  If my device is behaving really sluggishly, and I only have the camera open, how am I supposed to know that my location-aware-todo-list app is stuck in a run-ready loop when as far as I can tell, this app isn't running?  Most likely, I will just complain or file bug reports which are entirely unrelated to the camera.

 

I know there are solutions to this problem (eg. a process manager of some sort), but they are not as straightforward or simple as just allowing apps to fork() with impunity :smileyhappy:

 

Cheers,

Sean

Please use plain text.