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™ Development

Reply
New Contributor
Posts: 4
Registered: ‎07-31-2013
My Device: Q10
My Carrier: Airtel

How to get GPS location on application ported from android to BB10?

My problem is i am not able to get `network or GPS location` when `BB10 Device` is in sleep mode.My device is `Q10 Dev Alpha C` i have done following testing.

- Added run_when_backgrounded permission
- left application running in background.
- logcat is showing its requesting for location update.
- but location is not coming when device is in sleep mode.

same problem has been reported  at http://supportforums.blackberry.com/t5/BlackBerry-World-Development/GPS-stops-sending-amp-receiving-...


permission added are using custom `MANIFEST.MF`

access_internet,access_shared,access_pimdomain_contacts,play_audio,post_notification,run_when_backgrounded,access_location_services



Retired
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: How to get GPS location on application ported from android to BB10?

Hey there,

 

The "run_when_backgrounded" app permission is not available to Android apps, that's a Cascades specific feature.

 

Android on BlackBerry 10 acts the same as it does on an Android device, where if the device goes to sleep, onPause() (and potentially onStop(), onDestroy()) is called. So that's why you cannot get GPS location while the device is asleep.

 

    Justin

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com
New Contributor
Posts: 4
Registered: ‎07-31-2013
My Device: Q10
My Carrier: Airtel

Re: How to get GPS location on application ported from android to BB10?

thanks jjasmann for your promt response.

As i can see in logcat its requesting for location update. which means its not in onPause mode as logs i am getting is in onStartCommand and i am requesting location update through services.

Retired
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: How to get GPS location on application ported from android to BB10?

Sorry, I just meant that when onPause is called by the runtime, your GPS updates would pause/end as well.

 

    Justin

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com
New Contributor
Posts: 4
Registered: ‎07-31-2013
My Device: Q10
My Carrier: Airtel

Re: How to get GPS location on application ported from android to BB10?

Oh! k , Justin one more help would be hugely appreciated. Whether we can achieve what i am trying to do on BB10 or not?

regards
Akram
Retired
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: How to get GPS location on application ported from android to BB10?

Unfortunately not.

 

I think the only way you could achieve this would be with a background service, which isn't currently supported by our runtime.

 

    Justin

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com
New Contributor
Posts: 4
Registered: ‎08-18-2013
My Device: Q10 SQN100-1 10.2.0.1047
My Carrier: Bell Mobility

Re: How to get GPS location on application ported from android to BB10?

Should it be working now with the Headless mode by adding _sys_headless_nostopin the manifest? I probably have the same problem as Akram, I developped my tracking application for Android and it is defined as one Activity and one Service (data logging is made by the Service).

Retired
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: How to get GPS location on application ported from android to BB10?

_sys_run_headless  is a Cascades specific permission and will not be available to Android apps.

 

Android services are also still unsupported.

 

    Justin

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com
New Contributor
Posts: 4
Registered: ‎08-18-2013
My Device: Q10 SQN100-1 10.2.0.1047
My Carrier: Bell Mobility

Re: How to get GPS location on application ported from android to BB10?

Well, once the APK is converted to BAR, it is possible to unzip it and add informations in the manifest. One thing that looks missing is entry point at phone boot or something like that :

 

Manifest from my converted application :

 

Entry-Point: android://com.spectotechnologies.gpstracker?activity-name=com.spectotechnologies.gpstracker.MainActivity
Entry-Point-User-Actions: access_internet,read_geolocation,access_shared,play_audio

Highlighted
Retired
Posts: 264
Registered: ‎01-08-2013
My Device: BlackBerry 10 Dev Alpha B
My Carrier: Bell

Re: How to get GPS location on application ported from android to BB10?

The permissions in the MANIFEST.MF are mapped from the AndroidManifest.xml, so if you've added it in there, it should get added to your MANIFEST.MF automatically.

 

    Justin

Justin Jasmann | Android Application Development Consultant
Developer Relations
developer.blackberry.com