Skip to main content

Posts

Showing posts with the label GPS

Introduction and Example of Eventbus in Android.

EventBus is a library of Greenbot . This is very simple for all users how to implement and its basic use. Here I will also share examples for better understanding. What is EventBus? EventBus is subscribed/publish event bus to communication between components with limited lines of code, in short, its bus for events transfers the data between one activity(class) to another to reflect the changes based on our needs. That makes the data exchange between components like Activity, Fragment, Services, and any kind of backgrounds threads pretty easy. EventBus can handle the threading for us: events can be posted in threads different from the posting thread. Common use can be dealing with UI changes. In Android, UI changes must be done in the Main(UI) thread. In other words, networking or more time-consuming task cannot be handled in the Main thread, for that we must use AsyncTask or Handler to make it more smooth. Now we have one more options use EventBus to change the UI po...

Display Route in Google Maps API v2 on Android

I was looking for a way to get the route between 2 points and displayed in the Google Map using Google Maps API v2. After around many sites to get an actual idea of how to implement the Map Route in Android using Google Map API v2. First I will give you a small & simple description of the Map and Route. -    Route is just Poly-lines which is connected with each other. -    Google API gives routes between two locations. -    Also give Distance, Total Duration, etc. -    Just we want to give two coordinates between two locations (cities, states, etc.) Here I would like to share Google Map API v2 which displays Route between two locations. Please look below the Route between the two location images You can download full source code from here. AndroidMapV2Route Example AndroidMapV2Route.apk If you are satisfied with this post then please give your comments. Thanks for your interest!!!

Auto Turn Off/On GPS in Android

I was doing search from the net. There are multiple scenario to make application feature to enable/disable the GPS through Programming. If we want to track our children status where he/she going from School/college to any other place. So at that we can start GPS without notify them. Second scenario may be happen when our device is stolen or lost at any place and someone open our application or restart the device so automatic start our application and send data to our server. That also be happen. But this is not fully reliable that we get back our device. At lease we know the location where our device is Below code is used for enable/disable the GPS using Android by Programming. 1. Forcefully Enable the GPS if its disable 2. Forcefully Disable the GPS if its Enable [Auto Enable/Disable GPS Programmatically] If you are satisfied then please give your comments. Thanks for your Interest!!!

Get the Current Latitude Longitude using GPS

As per new Google Map API. They have changed in MAP integration as well as Update the Google Play Service to fetch Current latitude and longitude using GPS/Wi-fi. The location APIs make it easy for you to build location-aware applications. For that first you need to setup the Google Play Service through your SDK Setup Google Play Services SDK A compatible Android device that runs Android 2.2 or higher and includes Google Play Store. The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher. Install the Google Play Services SDK Launch the SDK Manager.  Install the Google Play services SDK. ( <android-sdk>/extras/google/google_play_services/ .) Install a compatible version of the Google APIs platform. Make a copy of the Google Play services library project. (Copy the library project at <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/)   [G...