Get gps provider setting mode - codenameone

How can I get the gps location method?
The image shows gps only is selected in the location setting. Is there any way I can get this setting in cn1?
Code in cn1:
Location locationn = LocationManager.getLocationManager().getCurrentLocation();

I'm not sure if this is what you are looking for but isGPSEnabled() is available in LocationManager. Notice it might throw a runtime exception on unsupported platforms.
You can use native interfaces if it's exposed to Android native but since it's Android specific it's not really a part of the API.
Notice the Location class provides getAccuracy() if that helps.

Related

Codename One, Possible to access photos without using Display.getInstance().openGallery()?

Is there are way for codenameone apps to access the images stored on the device programmatically and not using Display.getInstance().openGallery().
I want to construct my own gui for selecting images.
Thx
No. You can access these files as read only in a device specific way using native interfaces. Historically this wasn't possible technically in iOS and it was only possible to launch a picker UI to view the content of the camera roll.
For iOS the Photo's native API can be used https://developer.apple.com/documentation/photos?language=objc
It would require wrapping that with a native interface which is non-trivial https://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html

React Native Location Services “nearby” Implementation

I’m building a React-Native social media app with a feature that allows you to find other users who are nearby. I know React Native has location services capabilities, but I’m not sure how I would implement this type of background location tracking. Anyone know?
I hope you have built something like this by now, but still, I will try to help you out here.
Get user's current location and store it in ES/MongoDB. You will do this for all other users as well. So, now you have a data source containing all users' current locations.
Now do a query to ES/MongoDB to get users with their current locations in X miles radius of your current user's location.
Voila you have this feature ready.
PS: To get user's current location you can use the react-native-location package.
You can solve the problem through the library officially supported by React-native.
react-native-background-geolocation
Links you can refer to for troubleshooting

Navigate to settings screen when location is off in Codenameone

I want to navigate to Settings screen from my app when the location of the device is off.I did this in android,but i want to do it using CodenameOne. How can i able to achieve this in CodenameOne without using native interfaces.
Thanks.
That's something that only exists in Android and is not as commonly used now-days. Location is always on for modern Android devices since even if you turn off the GPS network location still works.

Ionic Offline MAP

I am working on a hybrid mobile app using ionic. I have developed all feature of app but One of the features I need is offline google map. I want to get lattitude and longitude of user when there was no internet and after reaching in interent zone it threw data using web API.
Is there a way how to do it? I want it for Android and Ios both.
If your issue is only getting the user location, that can be done with no need for internet. Instead, you can use GPS to get the location, and that can be specified by some options when you are getting the location, depending on what library you are using.

Gecko for windows forms and geolocation. How to accept request for share my location?

My main purpose is get my current geolocation. I've tried to do it with standart control
"WebBrowser" but geolocation is not supported by it. So now I'm trying to implement Gecko wrapper https://code.google.com/p/geckofx/ and xulrunner-3.6.28.en-US.win32.sdk (or xulrunner-1.9.2.19.en-US.win32) to windows forms.
It perfectly navigate to any url in windows forms.
But I've problems to get current geolocation in it. It doesn't give me a window to accept "share my location" as any other browser does.
How to do it? in wrapper using GeckoWebBrowser i've not seen any method or property to allow share location. So I think it should be made using xulrunner library.
How I can do that? Or if it's very complicated with gecko, what another browser I can use in windows forms to be able to get my current geolocation?
You will need to use a newer Geckofx
Also you need to ensure you exactly match the geckofx version with the correct xulrunner/firefox version.
GeoLocation doesn't yet have nice C# wrapper classes around it in geckofx, but you can access it using the xpcom C# interops.
var instance = Xpcom.CreateInstance<nsIGeolocationProvider>("#mozilla.org/geolocation/provider;1");
then look at the api

Resources