Chuyển đến nội dung chính

Bài đăng

Retrofit Android Example Tutorial

Welcome to Retrofit Android Example Tutorial. Today we’ll use the  Retrofit  library developed by Square to handle REST API calls in our android application. Table of Contents  [ hide ] 1  Retrofit Android 2  OkHttp Interceptors 3  Setting Up the Retrofit Interface 4  Retrofit Android Example Project Structure Retrofit Android Retrofit is type-safe REST client for Android and Java which aims to make it easier to consume RESTful web services. We’ll not go into the details of Retrofit 1.x versions and jump onto  Retrofit 2  directly which has a lot of new features and a changed internal API compared to the previous versions. Retrofit 2 by default leverages  OkHttp  as the networking layer and is built on top of it. Retrofit automatically serialises the JSON response using a POJO(Plain Old Java Object) which must be defined in advanced for the JSON Structure. To serialise JSON we need a converter to convert it into...

Get You Last known Location & Current Location using FusedLocationProviderClient

NOVEMBER 30, 2017 Get You Last known Location & Current Location using FusedLocationProviderClient        I would like to cover very basic and simple example of retreiving last known location & Current Location  using Fused location API.  I have written many example for fused location API in my previous posts but in this post i will show how to get retrieve the location  without implementing Google Api Client . All these magics happen after the release of version  11.0.0 of Google Play services SDK. FusedLocationProviderApi is Deprecated We have previously used following way to retrieve the last known location. mLastLocation  =  LocationServices. FusedLocationApi . getLastLocation ( mGoogleApiClient ) ; We no need to define LocationServices. FusedLocationApi  anymore. it is deprecated. It will be removed in the future release. Instead You can use LocationServi...