I want to create an app where the user enters a name for his/her current location and then it will save the latitude, longitude and altitude in a simple sharedPreferences file...
Things I need :
I don't want is to use internet, because it will be used in an area where there is no cell signal.
I know it will probably take longer to load coordinates without internet.. So I want to ask if it is possible to use a progress bar to indicate when it is done??...
Thanks a lot to anyone who helps me :)
Yes. You can use progress bar.
You can use location Locationmanager and LocationListener Model. In this model you will be given with all the callbacks you need.
You can use GPS when you have no internet connection, and you can use location search (by any method you'd like) when you have internet connection. However, your request to enter the location name, then find its coordinates is impossible to do if you have no internet connection unless you keep a DB of all location names and their coordinates on your device, which is only possible if you make a rather short list of specific locations, a few countries at most.
Related
I am trying to do something like the picture below of just eat app using android studio. I am yet to start building my app but I would like to know how to implement getting user postcode and showing it in the edittext field. Any help will do.
![img1] https://drive.google.com/file/d/186D7fjSvJOhEQdep_fU4dnkUGV-Yi8Ya/view?usp=drivesdk
If you are looking to allow users to identify their post code from their address you might find the Post Office Adress File (PAF) useful although this is a paid for service.
https://en.wikipedia.org/wiki/Postcode_Address_File
https://www.royalmail.com/business/services/marketing/data-optimisation/paf
Some developers may be able to get free sample data for developing their application
https://www.poweredbypaf.com/access-to-free-paf-sample-data/
If you want to allow users to graphically find their postcode e.g. by clicking on a map you would need a map which returns a National Grid Reference and then use Codepoint data (https://digimap.edina.ac.uk/webhelp/os/data_information/os_products/supporting/codepoint_guidance.htm) which is also (an expensive) paid for service to find the nearest postcode co-ordinate using some data structure e.g. quadtree. This will not work correctly in all cases as post code boundaries are not always convex.
Hope that helps
I am making an application which shows the nearby places of a given location. I take the location name and place types like museum,place of worship est. from the user and show the locations from that given type.
My problem is, I can't get some special places like Eiffel Tower because there is no such type. How can I get these kind of places ?
And these are the supported types: https://developers.google.com/places/supported_types
You probably use Nearby Search Requests, try Text Search Requests with query=attractions instead and don't forget to specify location and radius.
This is my first time using stackoverflow because I am really desperate to solve this issue.
I am developing an app that contains information about bus stops in my country (Google maps does not work if I try to go from X to Y on a bus) so I decided to do it myself. I already tracked every stop of many buses.
I show each bus stop as overlays in my osmdroid map view, I get this information from a internal database that as I said I collected the information and is not online.
What I want to do now, is to get the user's location (lat, long) and tell him/her the closets bus stops to him/her location. I already looked at Osmdroid bonuspack and the POI feature, but what I understood is that these places (restaurants, bus stops, hospitals, etc) are already on a server.
How can I implement a POI function on my application with local information. I would appreciate any help, this is something I want to do for my community.
Thank you everyone and sorry for my poor English. I am doing my best.
You already have the coordinates of bus stops in your database, and they are displayed in an overlay. You can also get the current users location. What you want to achieve is a matter of calculating the geographical distance between two points (the user's location and a bus stop).
You don't have to implement a suitable formula yourself, e.g. have a look at the GeoPoint class. There's a distanceTo(final IGeoPoint other) method. You can instantiate a GeoPoint with known coordinates or simply use Overlay methods.
You could also achieve the same thing by querying only the bus stops that are within a certain radius of the user's location (maybe have a look at the BoundingBox)
If you want to use libraries like the BonusPack, look at the provider implementations. You could simply write your own provider for your bus stops. Have a look at e.g. this one.
> How can I implement a POI function on my
> application with local information
I assume that your question is about "how to render busstops on local device" and not "how to query my local database" and not "how to do some server-side support."
If you want to render the busstops on you local android device you can use osmbonuspack
which contain an example app that shows how to render interactive poi-s.
Unfortunately currently there is no precompiled osmbonuspack aar at jcenter/mavencentral so you have to include the sources as a local subdirectory of your project.
I need to get the route a user goes through every day. I thought of checking the user's location every few minutes for 2-3 days and then analyze the information and get the origin and destination the user's going from and to every day.
The question is how will it affect battery life and is there a better way to do it. Are there any Android services that save the user's location history that I can access for this information?
You can register a broadcast receiver from the location manager to send you a broad cast if the location has actually changed. While I was working on something similar myself I found this blog post to be very helpful http://android-developers.blogspot.nl/2011/06/deep-dive-into-location.html
On iOS I created an application where a user can share his location and other users could see him on the MapView.
I did this by getting the location with a location manager, whenever it changed by x meters, and then wrote the lat/long with a device id to a database using a PHP script. The other user could then press a button to show the locations on a map by retrieving this data from the database.
Now here is my question. First I think this is the way to make a application like this. If you think there is a more efficient way please let me know.
What is the best method to update this data for showing users on the map?
For my iOS app I used a timer which would get the lat/long from the database every 30s or so, but I dont believe this is the most efficient or best method. The app would have to load the data every second even if another user has not changed his position.
Could you also push me in the right direction on how to animate the pin from the old location to the new location?
Thanks in advance.
Because there are no answers I used old method which is using a timer to update the latt / long in my database. Works ok btw but was wondering if there is a better way.