Thursday 30 March 2017

Android GMaps Current Location Using Fused Location Api

This is one of my best codes, to get user's current location using Googles Fused Location Api, coz it's accurate and it's faster in terms of acquiring location.
For this tutorial, the codes should ran in any device, even above api >21, due to the permission checks that i have implemented.

*Click view raw to view a formatted version of the code*

Project Structure: 



Step 1: Create New Project

- Go to start 'start a new project' from the welcome screen > Name it 'Android Fused Location' > Choose 'Google maps activity' *This is the main point* and finish to create the project.

Step 2: Api Key

- After gradle has synced successfully, android studio will open google_maps_api.xml by default. in this xml file, we are required to get our api key from google console and replace it where there is this
phrase "YOUR_KEY_HERE"

Step 3: Coding

i) We first have to add necessary permisions in the AndroidManifest.xml file.

ii)Add necessary libraries in the build.gradle (Module:app)

iii) NetworkConnection.java, this class helps us to check if gps and internet are available.

iiv) MapActivity.java, we add all the logic here, starting by checking if google play service is installed or updated, then we check for the permissions, if device is running android version >21, then we load the map and draw the current location.


Step 4: Running The App





33 comments:

  1. Remember to format the code or view raw for better codes alignment

    ReplyDelete
  2. Fantastic work! This is the type of information that should follow collective approximately the web. Embarrassment captivating position Google for not positioning this transmit higher! Enlarge taking place greater than and visit my web situate
    Data Science Training in Chennai
    Data science training in bangalore
    Data science online training
    Data science training in pune
    Data Science training in kalyan nagar
    Data Science training in OMR
    selenium training in chennai

    ReplyDelete
  3. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    Data Science Training in Chennai
    Data science training in bangalore
    Data science online training
    Data science training in pune
    Data Science training in kalyan nagar
    Data Science training in OMR
    selenium training in chennai

    ReplyDelete
  4. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    java training in chennai | java training in bangalore


    java training in tambaram | java training in velachery

    ReplyDelete
  5. Very well written blog and I always love to read blogs like these because they offer very good information to readers with very less amount of words....thanks for sharing your info with us and keep sharing.
    python online training
    python training in OMR
    python training in tambaram

    ReplyDelete
  6. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    AWS Interview Questions And Answers


    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    AWS Training in Pune | Best Amazon Web Services Training in Pune

    Amazon Web Services Training in Pune | Best AWS Training in Pune

    ReplyDelete
  7. Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.

    AWS Interview Questions And Answers


    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    AWS Training in Pune | Best Amazon Web Services Training in Pune

    Amazon Web Services Training in Pune | Best AWS Training in Pune

    ReplyDelete
  8. Very informative and helpful post and you are obviously very knowledgeable in this field. Very useful and solid content. Thanks for sharing

    Data Science

    ReplyDelete
  9. nice information and helpful iread it three time like it
    ExcelR Data science courses in Bangalore

    ReplyDelete


  10. Hi! This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job!


    DATA SCIENCE COURSE MALAYSIA

    ReplyDelete
  11. i Digital Academy ensures that each of you gain maximum knowledge based on current web trends, hence we employ trainers who are working in MNC. Making you ready for job and assisting you to get a job in Angularjs is our priority. Our Angularjs trainer focus on each and every detail to make sure you gain the best knowledge in terms of Angularjs . Your trainers with extensive experience in Angularjs and connections will refer you to companies that are looking for fresh talent after successful web development course completion.

    ReplyDelete
  12. Good to become visiting your weblog again, it has been months for me. Nicely this article that i've been waited for so long. I will need this post to total my assignment in the college, and it has exact same topic together with your write-up. Thanks, good share.360DigiTMG big data in malaysia
    360DigiTMG artificial intelligence in malaysia
    360DigiTMG machine learning course
    360DigiTMG

    ReplyDelete

  13. Watch All Indian Dramas In HD,Star Plus And Tv Zee Tv All Indian Shows Online.

    ReplyDelete
  14. Great article thanks for the share,Bigg Boss 14 Full HD Show Online You Can Also Watch Bigg Boss 14 in hd Full Length

    ReplyDelete
  15. Great article thanks for the share,Bigg Boss 14 Full HD Show Online You Can Also Watch Bigg Boss 14 in hd Full Length

    ReplyDelete
  16. Great information!! Thanks for sharing nice blog.
    Data Science Course in Hyderabad

    ReplyDelete
  17. Your website is really cool and a great inspirational post.financial analytics course malaysia

    ReplyDelete
  18. It's instructive and you are clearly entirely educated here. You have made me fully aware of differing sees on this point with fascinating and strong substance.artificial intelligence course in delhi

    ReplyDelete
  19. I see some amazingly important and kept up to length of your strength searching for in your on the site
    hrdf claimable

    ReplyDelete
  20. This is a great motivational article. In fact, I am happy with your good work. They publish very supportive data, really. Continue. Continue blogging. Hope you explore your next post
    360DigiTMG big data analytics training in malaysia

    ReplyDelete
  21. Very interesting article. Many articles I come across these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome. I will instantly grab your rss feed to stay informed of any updates you make and as well take the advantage to share some latest information about

    CREDIT CARD HACK SOFTWARE which many are not yet informed of, the recent technology and advantages of it.

    Thank so much for the great job.

    ReplyDelete
  22. I looked at some very important and to maintain the length of the strength you are looking for on your website
    HRDF training

    ReplyDelete
  23. Such a very useful information!Thanks for sharing this useful information with us. Really great effort.
    data scientist course

    ReplyDelete
  24. A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
    data scientist course in hyderabad

    ReplyDelete
  25. A really nice blog where we can found useful information.Thanks you.

    ReplyDelete
  26. Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing.
    business analytics course in warangal

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete