Trigger.io getting gps coordinates - mobile

I need to find the GPS coordinates of the device running my Trigger app. I need these coordinates to be as accurate as possible. If this were a native app, I would have the option of specifying the location provider (in this case I would specify gps). How do I do this in Trigger? The documentation for geolocation mentions that getCurrentPosition has a parameter for options, but does not explain how to communicate which provider I need.

forge.geolocation.getCurrentPosition uses assisted gps if it's available.
So it will provide the most accurate location position we can - obviously if the user has manually disabled gps, then it will use less accurate network location.

Related

How to detect user location?

recently I need to detect user location in an app. As you can imagine, there are many (obvious) solutions but I would like to have something like TikTok has in 2021.
After testing their method with virtual and normal devices, with VPN, with GPS mocking, simulated WIFI and Mobile data networks, and email addresses from providers stipulated in different countries, I still could not figure out how they detect my location and thus provide me content. Therefore, I consider their method superior over simple GPS or IP address-based methods. However, I wonder how they do it!
Any idea?
ByteDance (the company behind TikTok) uses your IP address and internet service provider info to get your approximate location, like a lot of other websites do (e.g. Athens, Greece). Google does this too - search anything you want and then scroll down to the bottom of the page. You can find your approximate location there.
I don't know how do they get this info, however, as I have not worked with networks and such.

Getting Locations Best Practice

What are the best practices one needs to know when trying to get the most accurate location coordinates from a user.
How can I explicitly get location using the user's gps? How can I also ensure getting location using the network is accurate? I am asking because when I get location while I am home..by the time I get to the office, the location I get is still the same which isnt supposed to be so. Does it have to do with my listener?
Any help/code snippets will be appreciated.
Salam
Modern Android devices and all iOS devices don't use GPS as much as they use hybrid location. Hybrid location correlates all sensor information (including gps) to give a location as accurately and quickly as possible while reducing battery usage.
This is on by default in Codename One if you don't do anything like explicitly specifying that Google Play Services shouldn't be included or if you include google play services other than location (without including location via the build hint android.playService.location=true) this won't be used either. In those cases Android will fallback to use GPS which is slower.
You can read more about build hints here.
Notice that even then getting location takes time so make a request so you should use the getCurrentLocationSync() method or the location listener API to make sure you get a more accurate reading.

Is there a way to save offline google map on hybrid mobile app on ionic?

I am planning to develop a hybrid mobile app using ionic. One of the features i need is offline google map. Is there a way how to do it?
It depends on the requirements of your application whether this will be possible. Are your users on "modern" devices A.K.A is HTML5 fully supported? Do your users need to view/edit the map globally, or just in a specific area? Does the map really need to be provided by google? I'll address some issues below to point you in possible takes on this problem.
Do you really need google maps? (Most optimal scenerio)
First of, do you really need google maps? Also relevant: how far do your users need to zoom their maps? If it can be any maps, and zooming is not really of high priority (if it is, including all map tiles will make the app eat all storage), you could probably use map-tiles as a packaged part of your app, and display them with a library like http://leafletjs.com/. The library is well documented, and provides a map-interface for a variety of map-providers. It will be do-able to configure this to use your own local map-tiles. You could include map-tiles for multiple zoom levels if necessary, and limit the min/max zoom-levels to the tiles you actually have available. This will make your maps work offline.
I can't or don't wan't to provide my own tiles make sure that you really looked into the option, there is systems out there that provide map-tiles you could use (check https://www.mapbox.com/ for example)
Okay, so you really don't want to do what I suggested. What are the options now? Javascript mapping-solutions typically render tiles based on the location of the map you want to see and the zooming level. These tiles are requested to the tile-provider. I do not know how to implement this for google exactly, you might need some research on this - I'll try to help you see a direction. There will be requests to get the tiles from the servers. I checked with http://maps.google.com what images are loaded when trying to navigate the map: (example (click)). Find out what url's are used in your situation, we will need these kind of url's later (just inspect the network tab in your browser console and see which requests are made when scrolling in your map). When we only need our users to work in a certain area when offline we could use service workers to cache the responses of these requests when we are online, and serve those caches when we are offline. Read more on service workers here (click).
Advantage: Real offline map-functionality for any tile you visited before (as long as your cache wasn't overflown, depending on your implementation of the service workers, and for service-worker supported browsers/devices).
Disadvantages: No support for tiles that were never put in the cache (AKA: never seen before). Another one: this will only work for devices that support service workers. Might be an option in situations where you either don't care about users using "older" devices, or where you can control the user's device choices. Note that using crosswalk could ease your developing efforts here, since you only have to consider one browser-runtime then: but crosswalk also doesn't support older devices.
However: This solution could be fine for people that will need to work in a specific area, which might be true for the case provided by #vipul-r If you or your users know in advance where they need their maps to work, you can instruct/help them in loading & caching their maps correctly.
If you can't work on either of these 2 solutions, then I highly doubt there will be a way to do it. I don't see any other way to the best of my knowledge.

WP7 - compass pointer

Sorry for the really general question, but I don't have a clue where to start. There's a component I want to develop for a WP7 application which is a an arrow that points in the direction (preferable X, Y, Z planes) of an address from where the user is currently located.
So for example, if you're lost in the woods and you have the address (long/latitude) of your house, it will always point you home.
Anyone know of any way to get started with this or samples or.....?
Thx in advance!
With the release of Mango you can now use the Compass class.
There is also the Raw Sensor Data Sample and How to: Get Data from the Compass Sensor for Windows Phone.
Unfortunately as of January 2011, Microsoft has not yet exposed the compass functionality with a public API. You'll have to wait till a later release for that.
If you are interested in the Latitude and Longitude, the GeoCoordinateWatcher is the place to start.
You can write so many miles East/West/North/South on the app page ( not worth much) if required.
You can even show a dynamic bing map with an indication of current location and destination using pins. But can't show the directions/orientation of the device w.r.t. actual direction.
You can get current GPS location and home GPS location. check the location service API http://msdn.microsoft.com/en-us/library/ff431803.aspx
Cant you use the GeoCoordinate.Course to get direction you are going?
Sebulba

Google Directions for Offline Demo

We are getting ready for a trade show early next month where we will not have Internet access on the show floor. We've put together machines with local installations of apache, mysql, etc. and are using host files to mimic the various domains we access.
But, one feature of our software is using Google maps to get directions from one address in the system to another. In order to show this, I need to be able to spoof a map or two.
I don't need to zoom in or do anything with the map image for the show. Just need to show the rendered map page with the directions list, etc.
I'm not having any luck with browser extensions to capture the entire page to an image. They either crash, or don't get the part of the map below the scroll.
Does anybody have any thoughts on how to get this rigged up for the show - either programatically or using tools that you've tried and found to work?
Amy
just do a screen capture of the whole page
edit: saw the part about not having luck with browser extensions. On a PC, you can try SnagIt, which has a scroll-and-capture functionality. Or, just do it manually and stitch together in photoshop. It can't be that long of a page....

Resources