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

Android™ Runtime Development

Reply
Contributor
boutros
Posts: 11
Registered: ‎06-07-2013
My Device: Blackberry playbook

App auto start on device boot

Is there a method to auto start a ported android application in runtime environment on device boot? If not will this be supported with the headless application release? I have been searching for a clear answer for a while but did not find one and hoping that I get a straightforward answer on this forum.

Thanks.

Developer
thechrissmartin
Posts: 53
Registered: ‎02-18-2012
My Device: Blackberry Z10 Limited Edition

Re: App auto start on device boot

what are u saying by auto restart?


_______________________________________________________

1. If any post helps you please click the Like button below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
Contributor
boutros
Posts: 11
Registered: ‎06-07-2013
My Device: Blackberry playbook

Re: App auto start on device boot

Auto start refers to application is started automatically on a device boot. On Android it is provided by the intent BOOT_COMPLETED broadcast when the device boots. The BOOT_COMPLETED broadcast is not delivered in the runtime environment per the intent limitations specified by the BB10 platform. On the blackberry Java development it is achieved by adding the auto start to the project property.

Developer
thechrissmartin
Posts: 53
Registered: ‎02-18-2012
My Device: Blackberry Z10 Limited Edition

Re: App auto start on device boot

K,1st of all this is not android,there's just a emulator.
There's no background running facility in BB10,which is expected to hit in 10.2 or 10.3 update......so how can an app start and run in the background

_______________________________________________________

1. If any post helps you please click the Like button below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
Contributor
boutros
Posts: 11
Registered: ‎06-07-2013
My Device: Blackberry playbook

Re: App auto start on device boot

An application in BB10 can run in the background when run_when_backgrounded is added to the project permission.

BlackBerry Development Advisor
bbenninger
Posts: 130
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: App auto start on device boot

run_when_backgrounded just means the app can still receive (minimal) CPU when placed in thumbnail. It doesn't mean they can run without a thumbnail.
Contributor
boutros
Posts: 11
Registered: ‎06-07-2013
My Device: Blackberry playbook

Re: App auto start on device boot

[ Edited ]

Thanks for taking the time to reply. The definition of run_when_backgrounded implies what you explained. However, in practice specifying the run_when_backgrounded had no difference on the application's behavior from the testing results explained below . 

 

On Android runtime a background service that is specified in the application manifest, wakes up when the alarm manager framework is used as a trigger. Closing the main activity or killing its process does not stop  the background process from waking up and running when it is started by the alarm manager.

 

This behavior contradicts with the documentation implying that no background services can run on bb10. Maybe it is a bug or maybe it is intended by design. On the other hand there was no explicit documentation stating that the alarm manager on Android is disabled. The contradiction is visible as the alarm manager by itself is a background process as well as the java runtime environment. 

 

It is not necessary to flag this behavior as a bug. On the other hand a good explanation of the contradiction is warranted. Developers spend an awful lot of time building applications and testing. A solid platform is what makes a good experience for the user and less headaches for the developer.

 

Tested on Device Z10, model-number STL100-3. Software release 10.1.0.273

 

Here are the captured logs:

006-12 14:04:48.226: I/ActivityManager(9519106): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.qnx.android.app.launcher/.LaunchActivity (has extras) } from pid 9519106

06-12 14:04:48.245: I/QNXNavigatorClient(9519106): setDaemonMode
06-12 14:04:49.255: I/ActivityManager(9519106): Force stopping package com.apps.gurutech.caloriesout uid=10144
06-12 14:04:49.256: I/Process(9519106): Sending signal. PID: 369188962 SIG: 9
06-12 14:04:49.258: E/Binder(8532175): READ FAIL 4 binder: 369188962:0 write 8 at 781695dc, read 256 at 781695dc
06-12 14:04:49.259: E/Binder(8532175): binder: 369188962:369188962 ioctl c0186201 8 returned 4
06-12 14:04:49.260: E/Binder(8532175): READ FAIL 4 binder: 369188962:0 write 8 at 780c08cc, read 256 at 780c08cc
06-12 14:04:49.260: E/Binder(8532175): binder: 369188962:369188962 ioctl c0186201 8 returned 4
06-12 14:05:40.201: I/QNXNavigatorClient(9519106): setScreenOff
06-12 14:05:42.487: I/ActivityManager(9519106): Start proc com.apps.gurutech.caloriesout:caloriesOutService for broadcast com.apps.gurutech.caloriesout/.AlarmReceiver: pid=369201250 uid=10144 gids={3003, 1015}
06-12 14:05:42.643: E/Binder(8532175): BINDER_SET_MAX_THREADS: 0-> 15
06-12 14:05:42.644: I/ProcessState(369201250): received buffer 29d60000, size 1040384 from binder
06-12 14:05:42.799: I/caloriesService(369201250): entering

 

 

 

BlackBerry Development Advisor
bbenninger
Posts: 130
Registered: ‎04-19-2013
My Device: BlackBerry Z10

Re: App auto start on device boot

:smileywink: