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
New Contributor
Posts: 2
Registered: ‎09-25-2013
My Device: Q10 - Developer
My Carrier: Singtel

Headless app - System start trigger

Hi,

 

I am a pretty new developer to blackberry, so please pardon me if I sound noob. 

 

I am currently interested in creating an app which requires it to start automatically in the background when the phone starts up or restarts to perform certain simple actions such as cleaning up the document folder for example.

 

I am looking into developing my app as headless using the bb.action.system.STARTED trigger. I have correctly set up my bar-descriptor.xml file using the Xandos app found on github. I managed to invoke the trigger with help from the sample app using the onInvoked() function. However upon restart of my Q10, nothing happens as expected because nothing is invoked. 

 

Is there anyway for me to get the system to invoke the bb.action.system.STARTED trigger every time the phone starts?

 

Thank you in advance!

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Headless app - System start trigger

My question here http://supportforums.blackberry.com/t5/Native-Development/Headless-App-developing/m-p/2592991#M47865 and Shadid's response (his second one actually, three posts after my question) appear to say that you won't be able to test this until and unless you've submitted the request form to get permission to sign headless apps, and had it approved.

As far as I know, nobody has publicly reported that they've received this permission yet (even though it's been many weeks for some), so it sounds like nobody except some close partners is likely to be able to test this yet.

I'd suggest you apply for the permission immediately, in case doing it sooner rather than later will help: https://developer.blackberry.com/jam/headless/

I suspect what's actually happening is that they're closely examining the requests to try to identify which permissions may be missing, so they can consider adding new ones instead of just granting this signing permission widely. Maybe some of us will be waiting until 10.3 before we ever get the chance to implement headless versions of our apps. :-(

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!
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Headless app - System start trigger

There's some suggestion that BlackBerry are doing this deliberately take a look at the article on CrackBerry for further information...

 

http://crackberry.com/rise-and-fall-headless-apps

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Headless app - System start trigger

I'd read that and the portion you're probably referring to ("To me it feels like...") makes little sense to me, though your own "doing this deliberately" is certainly a correct statement.

What they're doing is consistent with what they've already told us rather clearly, which is that they're reluctant to approve the headless permission widely. Their experience with BBOS tells them it would end up in a situation where the user experience is worsened by having all manner of apps running constantly and consuming resources when there are viable alternatives in many cases that can avoid that.

They're searching for ways of replacing as many of those use cases as possible with triggers, which are a lighter-weight way of dealing with the situation.

Really, there are very very few cases where an app would have to run all the time. Arguably there are NO such cases, provided you have all the right triggers, and the overhead of starting/stopping an app is low enough. (Even battery monitors such as Battery Guru should wake up only every two minutes or so when the battery updates arrive. A trigger for battery updates would then be sufficient, in theory. Unfortunately in practice they can arrive as often as every few seconds, so the overhead would be too high in such a case. That's the only reason I expect battery apps to be approved for headless in the current scheme of things though in the longer term even they may need to switch to one or more triggers.)

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!
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Headless app - System start trigger

Absolutely right, if all the triggers were available then only a fraction of apps would need to run continuously.

I hope for those planning on writing these kind of apps (I currently have no plans to use headless) the current 4 quickly gets increased.

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Headless app - System start trigger

I will add, however, that I think requiring the signing permission even for development mode (or failing to overcome whatever limitation forced that on them), and having it tied to an entire vendor account rather than merely filtering submitted apps, was a big mistake.

The manifest.mf file in each submitted .bar clearly shows whether the app wants the headless permissions or not. The system should be able to filter submissions that ask for that permission for an app which hasn't been granted approval. I think they should have done this by having you create a new product entry for an app that you want to use headless, and then request permission. They grant it by flagging that app as approved-for-headless, at which point you can upload releases which use headless.

Development mode should never have been restricted. If anyone enables development mode on a device, they should be able to install apps that take advantage of any permission which third-party developers can ever use, including headless.

Restricting us from even exploring and testing headless apps unless they're signed was, I think, a serious mistake. (Probably there are legitimate reasons for this, but I'd argue the priorities were wrong in the decision-making process that led to this. Maybe more transparent communication about the issues would help in this area...)

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!
Highlighted
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Headless app - System start trigger

One being the delivery of headless apps by nefarious means I would think.

Totally agree however, there are always different ways to prevent abuse but you should always try and put your technology in the hands of the developer as much as humanly possibly if you want to be supported.

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
New Contributor
Posts: 2
Registered: ‎09-25-2013
My Device: Q10 - Developer
My Carrier: Singtel

Re: Headless app - System start trigger

I do not need the app to be long running actually . I need it to start up automatically to do some clean up in the shared folders when the device starts/restarts.

 

According to the documentation, triggered headless apps are supposed to run for 20 seconds? I do not see any problems with the mishandling of system resources.

 

Seems like we need to wait for further updates from blackberry. Thanks guys for all the help! Cheers!

Developer
Posts: 105
Registered: ‎09-06-2013
My Device: Z10

Re: Headless app - System start trigger

And i though only long running and NON triggered apps need to apply for permission? Goes again to show how sometimes the documentation isnt well documented once again. 

 

On another unrelated note, the 3 Processor related functions in the HardwareInfo class is marked by the compiler as deprecated but the docs haven been updated to reflect it, weird.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Headless app - System start trigger

If it was my words earlier that makes anyone think a startup-triggered app that doesn't need to be long-running is one that needs that permission form filled out, don't trust me. I don't actually know whether or not that's true, though it was how I thought things worked. Not the first time I'd have misinterpreted docs though.

Anyone a better reader than I am? :-)

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!