App Works on the Emulator but not on the Actual Device (Asha 303)
I am developing an app that uses the Location API and the Maps API. When I run it on the emulator, it first asks for location permissions and it works fine (but the emulator gives it dummy values). When I deploy it on the phone, it doesn't ask for location permissions and immediately gives an error. :eek: I can't trace the problem since there is no output console when you run it on the device.
Do I need to add something on my code so that it would ask for location permissions?
PS. It is a J2ME app
Re: App Works on the Emulator but not on the Actual Device (Asha 303)
Hi Aldaneqwertyuiop and Welcome to Nokia Developer Discussion Boards,
You don't need to add anything in the code to ask for location permission on the device.
Make sure that Nokia maps jar is included while packaging your application and Internet connection is available on your device. Nokia maps jar can be downloaded from here [url]http://www.developer.nokia.com/info/sw.nokia.com/id/6bdf62e2-c739-4c29-bd9f-ddf8455f563e/JavaME.html[/url]
For logging on device, you can use File connection API (JSR-75). For example see the wiki article [url]http://www.developer.nokia.com/Community/Wiki/How_to_write_data_to_a_file_in_Java_ME[/url]
or use device debugging.
Re: App Works on the Emulator but not on the Actual Device (Asha 303)
If you are trying to get the Maps API for Java ME working with an Asha 303 or the SDK 1.1, you should be aware that issue with Markers has been raised and a fix is in the pipeline - further discussion will be consolidated in this thread:
[url]http://www.developer.nokia.com/Community/Discussion/showthread.php?235575-Map-API-Asha-and-Java-SDK-1.1[/url]
Re: App Works on the Emulator but not on the Actual Device (Asha 303)
Also keep in mind that Asha 303 does not have an integrated GPS receiver.
So if you are attempting to retrieve the location provider using this method:
[CODE]
lp = LocationProvider.getInstance(criteria);
[/CODE]
Asha 303 will attempt to find a Bluetooth GPS receiver. If you cancel the search, it will throw an exception.
Your device supports Cell-ID (network based) location retrieval so you need to retrieve the location provider using LocationUtil:
[CODE]
lp = LocationUtil.getLocationProvider(methods, null);
[/CODE]
More information about this:
a) [URL="http://www.developer.nokia.com/Community/Wiki/How_to_get_Location_Using_Location_API_JSR_179"]Example for retrieving location with a GPS module[/URL]
b) [URL="http://www.developer.nokia.com/Community/Wiki/Determining_Current_Location_via_Cell_ID"]Example for retrieving location with Cell-Id (Network based)[/URL]
c) [URL="http://www.developer.nokia.com/Resources/Library/Java/#!developers-guides/location-services/using-the-location-api/device-location/specifying-the-location-provider.html"]Developer's Guide on Location[/URL]