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
JUhrig
Posts: 31
Registered: ‎09-25-2012
My Device: N/A

Loss of GPS events when device goes to sleep using AbstractBpsEventHandler

Hey all,

 

I am noticing my application will not get gps events when the device goes to sleep. I have the setting for run_in_background set to true, but this does not appear to work for device sleep. Is there a setting for the AbstractBpsEventHandler to keep receiving events even when the device goes to sleep? 

 

I also found that the QGeoPositionInfoSource has the property "canRunInBackground

This property determines whether or not requests are allowed to run with the device in standby (i.e. screen off)".
Would this a better approach to the problem or can I somehow salvage my use of AbstractBpsEventHandler?
 
Regards,
 
-J
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Loss of GPS events when device goes to sleep using AbstractBpsEventHandler

I would expect you to need both of those set.

Without run_in_background your app will be frozen shortly after it is no longer fullscreen.

Without the other one, even though your app will still get CPU when it needs, it won't be receiving any events since the GPS subsystem has been shut down once the device goes into standby.

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!
Contributor
JUhrig
Posts: 31
Registered: ‎09-25-2012
My Device: N/A

Re: Loss of GPS events when device goes to sleep using AbstractBpsEventHandler

Since they are diffrent objects i should be using the QGeoPositionInfoSource instead of the AbstractBpsEventHandler?

Developer
smiley
Posts: 1,523
Registered: ‎07-14-2008
My Device: Z10

Re: Loss of GPS events when device goes to sleep using AbstractBpsEventHandler

i'm having the same problem when the device goes to sleep my app does not get gps reading.

 

Is there any fix?

BlackBerry Development Advisor
jehrismann
Posts: 68
Registered: ‎10-15-2012
My Device: Z10

Re: Loss of GPS events when device goes to sleep using AbstractBpsEventHandler

Hi,

 

Sorry for late reply, this post missed my search criteria. If you are using the C bps api and the geolocation events, you need to call geolocation_set_background() (passing true) when setting up your geolocation request. If you are using the C++ QtLocationSubset api then set the QGeoPositionInfoSource property "canRunInBackground".

 

This is in addition to having run_when_backgrounded permission ("Run as Active Frame") set for the app in its bar-descriptor.xml file.