Android - GoogleMaps Api v2 - Disable Internet Access - android

An application which uses Google Maps Api 2 has the advantage that all fetched map information are stored. Therefore they are available even when offline (no WiFi and no GSM). But if Internet is available it will download new data (the same data again) which is expensive when GSM is used.
Now I don't want to disable GSM entirely for Android. But only for the google maps object or say the application itself. I can't find any API function which can help me in order to allow googleMaps to (re-)download map information only when WiFi is available. So I have the choice between no internet at all or a pricy internet (when the application with google maps is active and already downloaded map information are redownloaded).
Is there a way to avoid this? Has anyone an idea how to override the regular googlemaps behaviour in order to control internet access or how a app can disable internet permission for itself temporary?
Thanks
Edit: To clarify - my question is: How can I disable the downloading of the tiles of a googlemap object without disable the object itself. I want to use the 'cached' tiles instead of redownloading it, which is expensive when using GSM. But I don't want to shut down GSM of my system so I'm available at chat clients e. g. whatsapp.

You can just identify the type of internet and then only call for certain methods if the proper type of internet is suitable for your needs.
In this answer from another post, you will find all you need to detect your type of internet:
https://stackoverflow.com/a/8548926/2074990

Related

suggestion result with offline mao

I have downloaded offline map and with MapEngine.setOnline(false) to make it working offline with that area, the map can be shown, but when I try to search some location, the suggestions list are very less than with online map, is that supposed to be so or anything wrong with my settings?
If you truly want complete offline operation, yes the search results will be limited when operating in offline mode (i.e. MapEngine#setOnline(false)). The offline search database is limited compared to online.
If you don't require being fully offline (i.e. no data being used whatsoever) keep in mind that simply by preloading the map data as you have done, far less data will be used by the HERE SDK during normal operation, so you can not call MapEngine#setOnline(false) and still allow Routing, Search, etc. to go online to get better results.
If you want to keep the SDK offline but only allow Search to go online, you can override the global (MapEngine) setting when making search requests by calling setConnectivity(Connectivity#ONLINE) for your search Request objects.

Android: access saved google locations programmatically

Google maps allows the possibility of saving favourite locations for ease of access later... see here.
In Android, where a location is required to be entered, it would be neat if there were an API to enable the user to choose from their already-saved favourite locations, e.g. via a picker dialog or something along those lines.
I can't find such an API... is there? The closest I've found is this and this, but these don't seem to allow picking from your stored locations.
There really isn't a way to do this, but you could create your own method to do it. You could have an ImageButton with a star (or anything that symbolizes 'save'). Use SharedPreferences to save the latitudes and longitudes that the users have entered, and then every time the application is loaded up, you could check to see if there are some values in the SharedPreferences. If there are, you could use a ListView to show all the saved locations, and then when one is clicked, return to the parent activity with the Location. Finally, use the Location to orient the map correctly.
Google/Android doesn't provide any public API to access the starred/frequent locations of a user and that data is only shared amongst the Google apps.
As this answer shows it might be possible to fetch location data via the Google Plus and Google Identity platform APIs
Alternatively (or in addition to), using Google's Plus Platform /
Google Identity Platform, if you have an authenticated user, you can
make an API call as described here (with examples) to get any of the
specified fields for the current user (including currentLocation,
organizations (including work) with addresses, if the user provided
them).
Take a look at this link.

How to fetch city events?

I wanted to venture into making apps. I wanted to make an app that gathers the events around the user location wise. I want the app to show the events close to user using the GPS of the phone. There is a city page where all the events are listed but I don't have any ideas how I will be able to fetch the data. What are the other ways I can go forward with this? It would be encouraging so that I can research further.
try this
http://www.last.fm/api/show/geo.getEvents
login this and get the api calls and use it in your code
i think you can use a combination of api's to give you the data you are looking for, one such provider i found was http://api.eventful.com/, you can probably even try including foursqaure and meetup's api and even facebook opengraph event api can also provide some handy data.

How to get the name of the nearest city

I have some app that sends some information to the internet from time to time let say ones at day. And I can easily send some coordinates (using the gps position) but I do not want that. The android phone is always connected to the internet via wifi or mobile network. But not always enabled the gps. So is it possible to get the location with wifi or mobile network ? I google this thing and I end up with finding location by gps, I do not want to do that.
Can you give me some ideas what can I do this. I have seen web sites that when I open them they know where am I, so I guess it is possible to find the nearest name of the city just by making a internet request and reading the response or maybe use some service . . .
Thanks
http://developer.android.com/reference/android/location/package-summary.html
http://developer.android.com/reference/android/location/Address.html#getAddressLine(int)
getLocality looks like it may do what you want?
For websites that know where you are, they either use your source IP and look that up (which isn't very reliable for a lot of things), or they use the javascript geolocation APIs as described here:
http://merged.ca/iphone/html5-geolocation
In fact, here's a stack overflow answer on using google API to get to the city name:
Get city name using geolocation

Using Google Transit information in Android app

Google transit provides approximate time of the next bus arriving at a particular bus-stop when you click on the bus-stop icon. This works for trains and even metro lines.
Is there any way I can use these transit information in my own map view? I tried going to the link that is displayed under the timings ( I guess it means thats where google is getting the timings from) but that link is broken...doesnt exist...it must be providing the information to Google only...
So is there any way i can access the Google Transit information?
Thx.
Yes, the data feeds are publicly available and published by the corresponding transit agencies. The available list is here. You'd need to download the data and host it or include it in your app.
In the "worst case scenario", you could download the result of a web query to maps.google.com (such as http://maps.google.com/maps?saddr=new+york&daddr=boston&dirflg=r) to your app and parse the result. Maybe there are even sample-scripts that already do this!
So finally i had to drop the idea...its only available for usa at the link given by #Robby but is (currently) unavailable for quite many countries.
Hoping itll be available soon.
Thx for all the responses.

Categories

Resources