Restaurant Finder App: Building with Google Maps SDK, Modularization and Clean Architecture

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back to new video and in this  video I'm gonna create a restaurant finder app   now this application is used to find a restaurant  which is present very near to you depending on   your current location so this is an intro and I'm  gonna tell you one by one what are the things I   will use in this video and apart from this  there are few small definition I Wanna Give   You So that you get a little more idea about it  the first thing which I will use in this project   is modularization yes this is a multi-module  application in which we have a lot of modules   and each module defined its own responsible  abilities so I'm gonna use here the combined   modulation approach so basically in modernization  we have three approaches the first one is called   layer wise modernization in which we have three  layers like data domain and presentation second   approach is a feature-wise mobilization in which  each feature has its own module and everything   goes into it now the third approach is a very you  know combination of these two so basically we have   feature and each feature contains three layers  data domain and presentation so by doing this we   have a clear suppression of concern it also help  us to follow the three architecture principles   and now the thing is why I am using this third  approach so basically we have three things which   is used to define the modernization is could or  not these three terms are coupling cohesion and   granularity these three factor is actually used  to tell you whether your moderation is good or not   so these three is defined very well for our third  approach which is combined so that's why I'm gonna   use this camera mind approach now the second thing  is how to manage your billet.grill dependencies   in big party model application in multi-module  application we have a lot of build.grall file   because every module has its own build.gradle  file suppose if you have any dependencies which   you wanna use in one file and also want to use  that particular dependencies in your other build   order then on that is that thing and it is a  not a good approach so I'm going to tell you   how to avoid this and how to manage your credit  dependencies properly with the help of kotlin DSL   yes we are going to use cotton DSL for managing  our dependencies and it is a very good approach   and also it is a very easy to follow we are going  to use clean architecture with mvbm pattern now   what is clinical texture well clear architecture  has three layers in it data layer domain layer   and we have presentation layer data layer has a  responsibility of taking data from our remote data   source or local data source and get this data to  our domain layer now the responsibility of domain   layer is to write business logic if you have any  and if you don't have any there is no problem   now move to our presentation layer now this  presentation layer is actually used to show the UI   to our user so we have our view model over there  we have our fragment we have our activities over   there so all the things which is visible to our  user is want to present in our presentation layer   and also if you have something which is purely  related to our framework thing then that thing is   also present in your presentation layer okay so  we are going to use jetpack compose UI in order   to create this application and apart from this  you will learn how to navigate in multi-module   projects so it is a very easy and I will tell you  very easy approach so that you will find a way to   navigate in multi-module application and apart  from this we are going to use a lot of flows I   like we are going to use mutable straight flow we  are going to use callback flow apart from this we   are going to use D bounce in order to produce  some throttle so that if user try to search   something then after a certain period of interval  we're gonna hit our API instead of hitting our AP   again and again if user type something so you  will learn how to use this debounce thing with   the help of flow we are going to use Decker  hint for our dependency injection framework   the most important thing in this application is  Google Maps so I'm gonna use Google Map SDK to   to render our maps in Jetpack compose UI apart  from this I'm gonna use its two more API which   is very important for our use cases like the first  API is places API so places API is actually used   to getting the list of restaurant based on your  current location second step is Direction API   so Direction AP is actually used to find the  route from your current location to the choosed   destination okay so these three things I'm gonna  use and it is super important for our application   okay so after reaching to our destination suppose  we reach to our destination then I'm Gonna Save   all the information for this destination in our  room DB so we are going to use a room DB for that   I mean our local database so you you will learn  how to set up our room database in multi-module   application and where is the best place to put our  database things so we will learn also and apart   from this you will learn type converters uh what  are type converters and why we use them so yeah   these are the things you will learn in this video  and I'm sure you are you are very excited so as I   and make sure to watch this video till end I will  show you the application demo after this this is   our home page and when I click search icon uh we  will reach to our process search screen so first   thing I execute this application for the first  time then we need location permission so I'm gonna   give this permission and after that I will click  on this three dots which will open this UI and   by using this location thing you will update your  emulator location so I'm gonna update my current   location of the simulator and I will choose set  location so it will update my current location   and here I'm gonna type kisori so it will give  me the Kishore restaurant I hope it will give   and there we go we have kishori restaurant  Bella pratapgarh up India so I'm gonna click it   and it will start the direction API it will  call Direction API establish a route from   kisori Southern to the kishori restaurant and  there you go you will see all these all the   direction thing over here okay so now again  I'm gonna open this and I will create a route   from this point from our current location to the  restaurant so I already did this from uh before   executing the application so this is our  route and I'm gonna start routing okay so it   will start route routing toward our restaurant  so just like this it will update our UI also   so after we finish our execution the information  is Gonna Save in our room DB and will again   reach back to our home page so wait for the  moment when we reach toward our restaurant so I'm gonna increase the speed  5x so that it will move quickly okay now I'm gonna reduce my speed so we successfully reached the destination  that information gonna saved in our room DB   that is reflected in our home page first you  need to create a new project so in order to   create a new project go to file select new  new project and you will see this dialog   So currently I'm working with flamingo so this  is a dialogue which I see so select this empty   activity and if you work in previous version  you have empty compose activity so select that   click on next and here you need to provide  the your application name or your package   name location and minimum SDK so I already  create a project so I'm not gonna create a   new project for that so I simply close it and  this is my new project okay so now it's time to   create few modules so in order to create modules  go to file new and here you will see new modules   click here and choose this Android library and  you need to provide your module name so I'm gonna   give it dashboard column presentation okay so  each feature contains three layer as I said you   are going to follow uh combined modulization that  means we have feature with layerization so each   feature contains three layer presentation  or domain and data okay so by using this we   follow clean architecture pattern so we have  dashboard feature and within this dashboard   feature we have our presentation layer okay and  you need to change this package name from com   dot Vision Android dot dashboard okay and simply  click finish so it will create a new module for   you so our module is created successfully over  here so we have presentation layer just like   this we have our data layer and domain layer so  choose this Android library and here you need to create a data layer for our dashboard  feature so dashboard dot data Okay   click finish so it will create a new module  within this dashboard directory or folder here you will see data layer just like this  you need to create your domain layer but we   don't gonna use the these two layer data line  domain layer in dashboard you will see why I   am not creating that domain layer okay we have  new module Android Library I'm gonna call this   common directory and within this we have  utils okay and make sure to add common here   okay simply finish it so it will create a  new common directory and within this within   that directory we have our utils module okay so  here you will see okay so like this we have our   location feature so create a location directory  and within this we have three layers data domain   and presentation so new module choose this Android  library and we have location colon first we have   our presentation layer and here after Vision  Android I'm gonna change my package name Vision   Android location dot presentation so finish it  here you will see we have location directory   and within this we have our presentation layer  so like this I'm gonna create two more layer   the second one is data layer change this package  name to Vision Android location dot data finish it and lastly we have our domain layer  so module Android Library here we have   domain change this Vision Android to Vision  Android location dot domain simply finish it all right so we have these features and its  layer okay and now it's time to manage our   build dot griddle dependencies uh because we  have a lot of features and every time when we   need any dependency we need to copy paste in in  its build.getel because if I open my scripts you   will see we have a lot of build.kidel so if you  want any specific thing here and also you need   to want that thing in our other build.gradle model  so you need to copy paste the dependency so we're   gonna find a way so that we ignore this step I  mean you need to you don't need to copy paste all   the dependency again and again so I'm gonna show  you how you will manage properly your dependencies   in multi-module application so for that first you  need to change your view from Android to project   and within this right click here create a new  directory and directory name is very specific   build capital S RC build source and within this  I'm gonna create a file so new uh we have file   and the file name is also very specific build dot  credle dot kts so basically I'm gonna use kotlin   for managing all of our dependency so generate  this and within this you're gonna write plugins   called Lin DSL and just below to this we have our  repositories so I wanna use only Maven Central   now sync your project and it will  set up all the things which we need   all right so our cotton DSL setup  is completed you will see our build   source is now looking in a different  way now within this I'm gonna create our   new directory and the directory would be Source  main Java this one and within this I'm gonna   create a kotlin file naming dependencies and all  of our dependencies I'm gonna copy paste in here   all right so I'm gonna show you one dependency  how we convert that thing and then after I will   copy paste all of the things which I gonna use  in this project okay so I'm gonna convert My View   From project to Android open my Gradle scripts  we have build a DOT 12 for model app level   so I'm gonna copy only this dependency go back  to your dependencies and here I'm gonna create   a object naming version okay and we have object  uh let us suppose uh I'm calling this depths   and I'm going to create a const file  of core paste my dependency here   convert this thing in a form of string and take  back my version number const while we have core   within a string paste your version code over here  1.8.0 and that thing you will utilize over here   so version dot core okay so now I'm gonna use  this steps within our build dot griddle remove   this use depths.core now simply sync your  project so you see our depth dot core is now   available that means the things which we wrote in  my dependencies is available to my build.itl and   one more thing I copy paste all the dependencies  which I'm gonna use in this project and also   there are few more dependencies which I I will  use in this project but I am not sure for that   okay so this is the way using which you will  manage your dependencies properly okay and   one more thing which I'm gonna tell you in your  build.gradle project level you need to change your   kotlin version from 1.7.20 to 1.8.20 and apart  from this in your module specific build dot Gradle   you need to change your cotton compile extension  version from 1.3.2 to 1.4.6 okay and your   compile options we have Source compatibility and  by default it uses version 1.8 but in our case I'm   gonna use version 17 okay so I'm gonna copy paste  version 17 in our source compatibility and Target   compatibility and in our cotton option jbm Target  I'm gonna change this from 1.8 to 17 okay so these   things you need to change in all of your build  Target like for utils for dashboard data layer   for dashboard presentation Lane everywhere okay so  I change all of our dependencies in that form so   that will manage very easily so this is for our  build.grill model available I change everything   and one more thing these compile options  these cotton options and our cotton in   compiled extension version and on the top we're  gonna use tiger Hills so that plugins we need   for that and in our build.gradle I already add  my diary dependency plugin okay just like this   for our common utils I make all the changes and  your version your cotton options everything then   we have dashboard data layer so dashboard data  layer is not gonna use in our project although   I created it I create it but it is not used okay  but you need to change this Source compatibility   and Target compatibility and our kotlin options  okay for our dashboard presentation you will   see everything is replaced in a form so that will  manage very easily uh its compile options cotton   options okay and on the top we have dagger  Hilt and one more thing you need to add its   compose options build features everything in  your presentation layer okay so just copy those   and paste in here otherwise otherwise  it will basically give you an error   so like this we have location data change all  the things it's caught in options compile options   on the top we have tiger Hill like this we  have our location domain change everything   here cotton option compile option on the  top we have parcelized we have dagger Hilt   and like this we have a location presentation  layer we have dagger Hill thing we have our   compile option cotton option and this is  presentation layer so we need to add all   those things which I copy paste in here so copy  this thing go to your presentation layer and   paste in here so that during the compilation  you won't see any crashes or error   okay yeah that's it there are few dependencies  which I am not converting in this way so it is   your duty to convert everything in this way all  right so this is all for managing our dependencies   now it is time to sync it and start writing our  actual code so first we will handle our navigation   so in order to do navigation in multi-module  application first I am going in my common utils   module and within this module I'm going to create  a package and the package name would be navigation   and within this navigation I'm gonna create a  interface and the interface name is feature API and within this interface I'm  going to create a function   naming register graph and within this  graph I'm gonna use my nav host controller and second is our nav graph Builder okay  so this is an interface and we are going   to implement this interfaces in our  feature modules so now it's time to   jump our dashboard module presentation layer and  within this uh we are going to create a package   which is of course related to navigation  so I'm gonna name it navigation and within   this navigation I'm going to give a separate  interface and that interface name is dashboard API and this interface is gonna use our feature  interface feature API interface this is not   available because our presentation module  doesn't know about common module common   utils module so what I am going to do go in our  build script which is for dashboard presentation   and here I'm gonna connect this module with our   common uterus module so implementation project  and within this I'm using my common utils sync   your project and return back to your navigation  dashboard API you can see future API is available   so import this and just below to it I'm gonna  create a class and the class name is dashboard   API implementation and this particular class  is Implement our dashboard API so Ctrl I and   here we have register graph okay so implement it  okay so within this particular function what I'm   going to do I'm going to create one more object  and the object name is internal dashboard movie   API okay this is an object and this particular  object is gonna Implement our feature API we have register graph so basically use this  register graph and within this what I am going to   do I'm going to use my navcraft Builder and this  particular Negra Builder has extension function   naming navigation so basically it will create a  nested navigation graph for us now the requirement   of this navigation function is start destination  and apart from this its route like navigation   is a nested so that means navigation graph is  also containing his own route okay so these two   are constant so I'm gonna create a few constant  enums for our this star destination and the route   so go in our utils module and within  this we have our navigation and within   this navigation I'm gonna create a file  and the file name is navigation constant and within this I'm gonna create a enumclass and  the enum class name is Nest State navigation route okay we have a Constructor and the  Constructor container route which   is a form of string so the first  nested route will be our dashboard enum is based on our location because  we have two features the first feature   is dashboard and second feature is location so  the nested navigation route for our location is   location now I'm going to create a one more  enumclass this is for our feature level navigation   routes like we have dashboard feature and within  this dashboard feature we have a lot of composable   so each composable content is destination so  for that I'm gonna create a dashboard a route   again the Constructor would be same   and within this we have only one basically screen  so for that I'm gonna call it home screen and   enable the home okay now for location we actually  have two screens the first screen is where users   see a restaurant and when when they click any of  the restaurant we move to our Google Map screen   so basically we have two screen so I'm gonna name  this location routes again the Constructor will be   a route as a parameter and it is a type of string  within this uh we have our places search or you   can say our restaurant search and I'm gonna call  this places and the second one is our Google Map and I'm gonna call this route name Google Maps  Okay so these are few constant which I'm gonna   use in my internal dashboard movie API so  for start destination I'm gonna choose my   dashboard routes home screen dot route and this  particular nested navigation contain a navigation   route and its name is would be nested navigation  route we have dashboard we simply pass the route   all right now within this we have a composable so  use that composable and pass your route here so   in my case we have only one dashboard route home  screen route and when this route is exactly same   uh we are going to render our  home screen composable so for that   I'm going to create a new package and the  package name would be screens in this screen   I'm gonna create a package and the package  name would be home and within this home we   have our composable so I'm gonna create a  file and the file name would be home screen   this is a file and within this we have  we have our composable naming home screen   uh that's it for now go to your  navigation internal dashboard   movie API and when this route is exactly  same then I'm gonna use my home screen   all right now I'm gonna use this internal  dashboard movie API to our dashboard API   implementation so I'm gonna use this register  our graph pass nav host controller and nav graph   Builder okay so this is all for the implementation  part now I'm gonna create one more package which   is for dependency injection right click create  a new object and the object name would be present ation module  installing Singleton component and this is a module so in order to  tell dagger this is a module please   take this as a reference you need to  add this module annotation now what I   am going to provide here so in order to  provide we use provide rotation function   provide and this time I'm gonna provide  our dashboard API so dashboard API   return type is dashboard API and we simply  return the implementation of this particular   interface so we have dashboard API implementation  that's it this is all for navigation in dashboard   now we have to do similar thing with our location  feature so go to your location presentation layer   first thing first I'm gonna connect this  presentation module to our feature sorry   to our common utils module so in order to do  that go to its build dot griddle presentation   so this one and here what I'm going to do in the  dependencies I am using implementation [Music]   project we have common and within this common  we have utils now sync this is completed now   within our presentation I'm gonna create  a package and the package name would be of   course navigation apart from this we have second  package which is for screens okay so within this   navigation I'm gonna create a interface and the  interface name would be location feature API   this particular thing is going to extend our  feature API which is present in our common utils   module okay now below to it I'm gonna create  a class and the class name would be location   API implementation I'm gonna implement this thing   so after this I'm gonna create a object and the  object name would be internal location picture API extend this sorry not extend  Implement our feature API okay so here we have our nav graph Builder I'm  gonna use navigation we have start destination   and we got a route so in place of route  I'm gonna use my nested navigation enum   on a state navigation route dot location dot route   okay and within this we have a composable we need  to pass the route so this time route coming from   our location routes Dot places search dot route  okay we render our places search composable   we have second composable and the route would  be location route dot Google Maps dot route   and render our Google Map screen okay  so start destination will be this one   so copy this paste here all right so I'm going  to create two screen one is for places search   and the second one is for Google Maps So within  our screen I'm gonna create two package uh the   first package will be places and the second packet  would be our Google Maps are not within our places   Google Maps Okay so within this places I'm  gonna create a file and the file name would be   places search this is a file and within this we  got a composable uh Resto wrong finder screen and with this Google Map uh I'm going to get a  file and the file name would be Google Maps screen   and within this we have composable naming Google  Map screen cool and I'm gonna use these two screen   within our location feature API sorry not location  feature API but in internal location feature API   and here we are going to call our places  screen which is a restaurant finder screen   and here I'm gonna call my Google Maps  screen now use this internal location feature   API in our location feature  API class implementation so internal location feature API register  graph password controller and nav Builder   okay this is done now I'm gonna create a  package and the package name would be di   because I'm gonna provide this implementation  through dagger so right click go to new   create an object and the object  name would be presentation module installing Singleton component annotate this thing with module and within  this I am going to write a provide function   which will actually provide the implementation of  this location feature API so location feature API   all right 100 type would be location feature  API and I'm gonna return the implementation   that's it that's it from navigation  perspective for this particular module   all right now I am going in my iPhone module  and within this app module uh I'm gonna create a   package and the package name would be navigation   and within this navigation I'm going to create a  data class and that data class name is navigation   provider and this will basically take two  variables the first variable which is called   this one the dashboard API dashboard API  okay so this app module doesn't know about   this modules like dashboard module dashboard  domain presentation module and location data   domain presentation module so what I'm going  to do in our build.gradle module app level   I'm gonna call implementation project and  within this first I'm gonna use my location data   and duplicate it we have data  we have domain and we have   presentation again duplicate it after  that we have our dashboard presentation   and also I need to connect this particular module  with common so common eutils sync your project   Now app module know about all these modules  go to your navigation provider and here   I'm gonna use dashboard API I think now it's  available and second feature API is location   so location feature API location picture API  okay so we have navigation provider now I'm   gonna create a package for dependency injection  right click create a object and this time the   name would be app module and I'm gonna  install in our Singleton component annotate this thing with module and within  this I'm gonna write a provide function   provide navigation provider now the input  for this function would be our dashboard   API and our location feature API and the  return type would be navigation provider   return a navigation provider object so we need to  pass dashboard API and location feature API I'm   not going to create this particular navigation  product again and again so for that I am using   Singleton okay now within our main activity we  have to use this annotation Android entry point   and after that I'm gonna use field injection  and inject this navigation provider okay now I'm going to set up my dagger hilt so  in order to set up right click create a new base   application as you already know about this so  we have base application class and this class   extend the application and annotate this with  Hilt Android app and register this application   name to your manifest which is base application we  are going to write a small navigation composable   So within our navigation package I'm gonna  create a new file and the name would be Main   navigation now this is a file and within  this we have composable naming Main   navigation and within this we require now host  controller within this I'm called my nav host so   the requirement of this nav host is nav host  controller and I'm gonna use here the second   Constructor which is uh taking nav controller  and the star destination So within this starter   destination we need to find we need to give the  nested navigation route so in order to give the   nested navigation route we have already a enum so  I'm gonna use that in a nested navigation route   dot so first I'm gonna jump in my dashboard so  that means I need to pass the dashboard route   okay so now within this nav host Lambda  expression what we are going to do so   we need this navigation provider so take  that navigation provider as an argument   and use it so like navigation provider dot here  we have dashboard API now dashboard API contains   register graph and the input of this Hyster graph  would be nav host controller and nav graph filter   now nav graph Builder is already present in  a form of this Lambda expression parameter   okay so similarly like this we have our  location feature API which has register   graph pass your knife host controller and  knife craft Builder that's it this is all   for the navigation now I am going to call  this main navigation in my main activity   all right so from here I'm going to call  our main navigation we need to pass our   nav host controller so just create a new host  controller over this surface well host controller remember host controller no  need to pass this Navigator   simply use this nav host controller Sorry by make  a spelling mistake copy this paste here and second   one is our navigation provider that's it this is  all for the navigation uh which we need to do in   multimodal applications so now navigation part is  done so it's time to recapitulate what we did in   order to perform navigation So within our common  directory we have utils module and within this   utils I am going to create a feature API interface  this interface container functional register graph   and the parameter of this function would be  navhost controller and the knife craft Builder   okay so we use this particular interface in all  of our features like we have two feature dashboard   feature location feature So within our dashboard  feature we have a navigation package and this   navigation package contain dashboard API which is  an interface and this interface uses our feature   API that means all the properties that feature  API has is now available to our dashboard API   apart from this we created a class  dashboard API implementation which   is uh writing the implementation for this  dashboard API now dashboard API container   style graph function and this particular thing  is gonna contain all of our navigation logic   so go to your internal dashboard movie API  and here we create a nested navigation give   the route to its nested navigation and also give  a start destination so we have home screen as a   star destination and our composable is also  contained the route dashboard home screen   route that means the first screen is home screen  which is visible for this particular nested graph   and just like this we have our location feature So  within our location feature we created a location   feature API it's just a wrapper we use feature  API now all the properties that feature API has   is available to our location feature API now we  we wrote a implementation for that and all the   navigation logic is present in our internal  location feature API which is an object over   here so again with the help of Niagara Builder we  use navigation extension function and within this   we pass our nested navigation route and the start  destination for this particular navigation so star   destination is places search route that means our  first screen is this one the student finder screen   okay apart from this we use dependence injection  in order to provide that implementation for this   location feature API the question is why you  created this interface basically it is a wrapper   over feature API if you don't do that you will  write the implementation for future API yes it   is possible but in our dependency injection  then that particular case we have a feature   API is the return type now this feature API is  also provided from our dashboard so you need   to create a custom annotation for that in order  to differentiate between this implementation for   the location and dashboard so that is why I am  creating this interface so that it is very easy   for understanding that this particular thing is  used for location feature and for our dashboard   feature okay so this is a basically in use case  for this it's time to create our domain layer and   data layer for location feature So within our  location with our domain I'm gonna create few   packages first so the first package name was  dependency injection second package name was   Repository third was our domain layer  model and the fourth one is our use cases all right so within our repository I'm  gonna create a interface because this   interface is going to implement it with our  data layer so the interface name was location repository and within this function within  this interface I am gonna create a function   and the function name was get location once and  parameter for this function would be location this is a Lambda expression which has a  input of location and output is unit okay   next is our search Aristo runs we need to pass query and the return type would  be flow so make sure to import the correct flow   places result all right so this places result is a shield class  that I am going to create in our common module   utils So within our utils I'm gonna create a  package and the package name is events and results okay within this I'm going to create a sealed  class and the seal class name is places   result okay and within its  parameter I'm gonna pass location initial value is null second one is list  which is a type of mutable list of auto   complete prediction and initialize this  thing with mutable list of the third one   is message if anything goes wrong we need to  pass the message and initialize this with null   and within this we have a class for our success  case so if it is a success case we got location   and also we got a list which is a type of  notable list of autocomplete prediction and   extend this with places result past our  location and list okay second one is our   loading state so in our loading State we don't  pass anything we simply extend our process result   next is our ideal case so again no need to pass  anything in its Constructor the last one is our   error so in error case we got a message type  is string and extend this thing with places   result pass message init so this is a sealed  class go to your location repository import it   now it's time to implement this interface  in our data layer so first I need to connect   our data layer to domain so go to build dot  cable for data layer location duplicate this   location and domain sync it go back to your  data layer module and within this data layer   I'm gonna create few packages so first package  would be for dependency injection then for our   repository implementation and after  that we have something which is called models okay so within our repository I'm gonna  create a class and the class name would be   location repo implementation okay this will  implement the location repository once this   cradle build sync completed the ideas so we have  location repository and within it we have two   function get location once and search restaurants  So within our get location once uh we are going to   use fuse location product line because with  the help of that we get a current location   so I'm gonna use Constructor injection Passover  private while fuse location provider client import this inject and now it's time to use this  thing within our get location once so remove this   to do and here I'm gonna use fuse location provide  request location update So within this we need to   pass location request and the location callback so  we need to create that so first I'm gonna create   our location call back so create an object for  that location callback and within this we have   on location result so every time when our fuse  location product client generate a result that   result is gonna come in our on location result  function okay so we got a result and I'm gonna   remove this thing and use our location Lambda  invoke it with the help of our P naught location all right so this is our implementation of our  own location result now we are going to create   a location request so we have a location  request with the help of location request   make sure to import the correct one and the  correct one is com.google Android GMS location   so use its Builder and here you need to pass the  priority so pass priority high accuracy and pass   your first interval then we need to set up our  interval in millise which is one second in my case   and apart from this we only want location update  for once so we use set max update once and lastly   build it okay so now we have our location request  location callback so simply use this within our   request location update so location request  location request callback in the Looper personal   so this thing require permission  access course location so we are   in a repository and we don't take any kind of  permission here so I'm gonna use here suppress missing permission so it will remove this  error okay apart from this I'm going to   create a private well current location  variable here which is a type of light long   and initialize this slide along with the light  long we have 0 comma 0 latitude and 0 comma Zero   longitude now every time we get the location  update we simply update this current location   so make this war and here once we got the  location update we use current location   create a new platform it dot latitude it dot  longitude so by doing this we get a reference of   our current laptop within current location so this  is our implementation of our get location once   now it's time to implement our search restore  runs so this search restaurant is actually   uses the Google Places API so in order to  use Google Places API we need to inject   places client here so private well  places client okay now remove this thing   we have places client dot find autocomplete  prediction this is fun this is the function   which I am going to use in order to get the  restaurants so the input of this function   is find autocomplete prediction request so it  require a request so I'm gonna create that request so it is find autocomplete prediction  request we have Builder pattern here so   we first set our session token so in order  to create session token we are going to use   auto complete session token dot new instance  so it will generate a token for us so simply   pass your token here now we need to set up our  countries in which country you want to search   the restaurants so in my case it is India post all  right so after that we need to set up our query so   pass your query here apart from this you need to  set up the filter type so set types filter this   is a mutable list of so basically we want only  restaurants so I'm gonna pass only a Resto ront   and lastly we need to restrict the location  because we don't want to search all of our   word we only want to search a particular area  which is depend on the user current location   so I am going to create this location restriction  and pass this location restriction within this   set location restriction so for that I'm  gonna create a variable naming location risk   restriction find location risk friction and  within this we need to pass location so how I   get the location well we already created that  thing get location once simply cut this out   paste in here now we have a location here use this  location within this okay and here we need to pass   the origin basically it asks you for the current  location so use lat long now we have location so   pass location dot latitude location dot longitude  got it now it's time to create this find location   restriction function so Alt Enter create  function and return type is location restriction   all right so within this function I'm  gonna take a leverage of rectangular   bound new instance here we need to pass  the southwest and the Northeast lat long   so just pass your lat law so we use this  location dot latitude and minus point   nine init similarly we have location dot longitude  and simply minus 0.9 init okay duplicate it and   this time remove this signature and make it plus  so it will basically create a square uh depend   on your current location so I will tell you how  it is working but before that let's finish let   me finish this so location restriction is used  here and that's it lastly build it okay so now   we have a request use that request here add-on  success listener so now it's time to send the   event from this function so how I am going  to send this because I don't create a flow   so what I'm going to use I'm going to use  callback flow so by using callback flow it   is very easy to convert this type of function  in a form of flow so just see this try send   use places result dot success and  just pass your location and your   auto complete predictions if it is a  case of failure then again use try send   process result error and this time we need to  send the message convert this in a form of string   all right so this is all for this particular  search restaurant function implementation in   this image you will see a Cartesian plane x axis  and y axis so I want to wrap this particular so how do I do that so it is very easy just  move one unit along the x-axis one unit along   the y axis you got this point similarly just move  minus 1 unit to our minus x axis and then minus 1   unit 2 over minus y axis now simply connect these  points so it will create a square so this is a Sim   similar thing which I already did in here okay so  just see this is an origin I differentiate a few   constant this is another point I differentiate  a few constant like this we also did this thing   so it will basically create a square so this is a  use case for this fuse find location restriction   all right so now we already create this  implementation for get location once and   States restaurants now it's time to write  a dependency injection module for that   so right click new create object and  the object name would be data module installing in the Singleton component this is our model so and create this thing with  module now we require two thing the first one   is fuse location product line so I'm gonna  create a Singleton for that provide function   provide fuse location provider client  okay so requirement is application context and the return type is fuse location  provider client return locations services   dot get fuel location product line pass your  context like this I am going to create a places   client for us so provide function provide places  client okay now within this we are going to use   places dot initialize requirement is context  so I'm gonna use my application context pass your context here and second  one is API key so pass your API key   and now return the places dot create client and  again pass your context so it will basically   create a braces client now the return type  is places client cool so we're done with   this fuse location product client and the places  client now it's time to provide the repository   implementation so I'm gonna use provide function  provide location repo and the output is location   repository return location repo  implementation and the input is fuse location provider client and we have  place this client pass both of this in here   all right so we have done with our data layer  now go back to your domain layer and within   our domain layer I'm going to create a use cases  and that use case name is search address to run   use case search restaurants use case and within  this I'm gonna perform Constructor injection   and pass our repository private wire  location Repository and here I'm gonna   create a operator function in book Passover query  in a form of string use our location Repository   search restaurant pass your query here  so I'm gonna provide this particular use   case from dagger Hilt so create a object and  that object name is domain module installing Singleton component class  module and I'm gonna use provide function provide search address to run use  case and the dependency for this is location   repository and return type is search   a restaurant use case pass your location  repository and change the output cool we are done with our domain layer part  now it's time to jump into our presentation   layer So within our presentation layer  we already did are these screen things   we have our places screen now I'm gonna  create a view model for this so we have places search view model uh I think I forgot  one thing in our repository implementation   so within our callback flow when you  use callback flow make sure to call   this thing also otherwise it will  crash your application await close   okay so now jump back to your view model and  here I'm gonna extend this with the view model   annotate this with Hill to view model and I'm  gonna perform a Constructor injection here so   for that I'm gonna use inject Constructor  private while search restaurant use case   import this all right so here I'm gonna create a  functions search address to runs pass your query   and I'm gonna use view model scope dot  launch and within this I'm gonna call my   search restaurant use case Passover query and  collect the latest changes or the latest emissions   so it will limit places results so in order to  capture that thing I want to create a private well   variable naming search which is a type of new  tables State off not flow mutable state import   this and within this the type would be places  result okay any slice this thing with mutable   list of places result and you need to pass the  initial value so it is places result dot ideal okay I think okay sorry this is not a  mutable list this is a mutable state   of import this mutable state now it's cool  so I make a spelling mistake here s e a r   sorry for that this is a very important  thing you know well search we have state and the type is same use the getter and initialize  this thing with underscore search import this   state all right cool so every time when I  get the emission from our use cases I'm gonna   use my search dot value and updated all right  cool now it's time to go in our places screen   now here's the first thing what we need to  do is taking a permission so in order to   take permission I use a library which is coming  from accompanist so I'm gonna create a variable   permission remember multiple permission state  within this we need to pass our list off and the   list of permission basically so first one is our  Android manifest permission we have access course   location just like this we have Android manifest  permission access find location although this is   an experimental API so you need to activate  this thing with experimental permission API   apart from this I'm gonna use our view model as a  parameter so that view model is places search view   model and I'm gonna change this thing within our  internal location feature API so here I'm going   to create a variable naming view model which is  initialized by with the help of Hill to view model   and type is places search view model simply  pass this view model within our restaurant   finder screen Okay jump back here all right  so yep so if it is a case that our permission   all permission is granted then we need to do  something else if it is not granted then on   that occasion I'm gonna use launch Effect called  Unit so basically pass unit and here I am using   my permission launch permission request so that  it will show our user we need this permission   if you gonna give me permission then I will show  you otherwise we don't show you okay so we have   all permission granted right now so I'm gonna  create a variable and that will store the list   which is coming from our viewmodel DOT search Dot  value so this is not list this is a places result okay so now depending on the places  result State we actually render our screen   so we have few type of state for our  places result the first one is our loading we have success we have  error and we also have ideal   so for error I am pretty sure this is very  easy just create a box and that box has a   modifier of fill Max size content alignment  in the Center and lastly just create a text   and pass your message like places  result Dot message dot to string   okay so for our loading case I'm gonna simply  copy this paste in here remove this text and   use circular progress indicator and for  Success case I'm gonna create a constraint   layout that contain a text field on the top  or search bar and in the bottom it container   lazy column all right okay so I'm going to  create a constraint layout we have modifier modifier fill Max size and within this I'm  gonna create a variable and the variable name   is search cons and list cons we have create riffs  which create a references now we have text field so ignore all this thing use modifier here so modifier fill Max width and we have our  constraint is so this constraint is search   constraints and within this I'm gonna start  the linking part so I'm gonna link this start   part of this text field to parent start end part  parent end and top is link to the parent top cool   so this is for our text field constraints now we  need to use this value and on value change thing   so in order to use this thing I'm gonna create a  variable within our view model so we have private   well underscore query which is a type of mutable  State flow type is of course string and I'm gonna   initialize this thing with multiple straight flow  of empty string I'm gonna create a query which   is a type of State flow so type of string get  underscore query now it's time to update our query   so pass query and update our underscore query  mobile with the help of this okay so by doing   this we need to do something else in order  to search the restaurant so we create an init   blog and within our view model scope I'm gonna  launch a protein scope and within this I'm gonna introduce throttle in our query and then collect  it and once I get the query I simply call our   search restaurants okay now I'm going to use all  this thing in our processors So within our value before writing our value part on the  top I'm gonna create a variable query   that is initialized with the  help of view model query Dot   collect as state so that if anything could change  in our query it will reflect in our compose so here I'm gonna pass my query value and  within this on value change I'm gonna use my   viewmodel Dot update query and  simply update our query all right so this is also an experimental API  so you need to add your annotation experimental material 3 API on the top okay  so this is all for our text field now it's   time for our lazy column So within this lazy  column I'm gonna use its modifier modifier constraint is so we have reference and  the reference is list cons   and here I'm gonna use start  link it to its parent start   uh we have end link to parent end we have top  which I link with our search constraint bottom and we have the bottom which  is link to the pent bottom okay so words come to height   I'm gonna use Dimension fill to constraints  so that it is not present on the center okay so we did this and apart from this   we use items and that items is coming  from more places result dot list okay import this now one by one I am getting my restaurants which I  find from our Google Places API so I'm gonna use a   simple text and use it dot get full text personal  layer use to string and use modifier so that   it is appear in our all width and I'm gonna start  I'm gonna give some padding to it like 12 DP Okay so import this TP all right I think it's done the  presentation layer is also done   so what I am going to do I'm gonna tell you  how you can put your API key so in our data   layer data module you need to put your API key  here first and within our manifest within our   app module manifest to add this metadata and  provide your API key over here okay so I'm   gonna add all the API keys and then after  I execute this application in my emulator   or app executed successfully this  is a permission so I'm gonna give it and this is a problem great for the first time when you give  the permission then this success state   is never called because we don't call  the query we didn't call our use case   so this is a reason why you will not see  anything here so what is a fix for that   so it is a very easy just put your constant  layout out of this places resulting okay so   I'm gonna do that so in order to do that I  am going to create a constraint layout here and just copy all these stuffs  like we have here this thing   okay so cut it here and paste within  our constraint layout and within our   constant layout we have modifiers so  just cut out the modifier paste in here   and remove this constraint layout from success  in this constraint layout I'm gonna put our when   expression so cut this out and paste it here now  you will see there is no error and this is a fix   for that so again open your emulator go back  install uninstall this app and execute again and if you click on this three dot it  will open this interface and with the   help of this interface you will set your location   so I'm gonna set up this point as a  my current location for this emulator there you go Application executed successfully   and this is our first time and it will  ask the permission so give it permission okay so permission is granted and you will  see our text field now within our text field   I'm gonna type kiss Ori and based on the  location it will give me the results like   this one so we have kishori which is very near  to me which is I think kilometer far from here   okay so I think this is a complete implementation  of our places API you will see how to integrate   places API with our multi-module applications  and yeah this is our places API integration   now we will continue with our Google Map part so  if user click any of this restaurant we simply   start the route from from the current place  to the restaurant so it will create a route   and will you when you navigate through your  route it will automatically update that route   so we will do that so we are done with our places  API now this places API return auto complete   prediction object and within this autocomplete  prediction object we receive the name full   name and we receive the places ID and few other  information which is not very relevant to us we   require that restaurant destination latitude and  longitude we require its name its address whether   it is opening or not delivered is available or not  so all this information will require but with this   API we are not getting that particular detail so  in order to get that detail we need to hit another   API so let's integrate that API so in order to  integrate that API go to your location repository   interface and here create a function naming fetch  place and we need to pass the place ID this place   ID we received with our places API and the return  type of this thing is flow and within this flow   we have place details now this place details is a  model domain layer model which I'm gonna create in   our model package so right click new uh choose a  data class and give a name to this particular data   classes place details okay created now within this  I'm gonna store my place ID first type is string   of course second one is name which is a type of  string third one is the destination of course so   we have Destination type lat long and the fourth  one is our origin I mean where we start navigating   so light long and apart from this delivery is  available or not so type is Boolean then we have   something which is called rating and is super  important okay so we have this information now   we require this information so hit that API and  collect all the information which we require so   import this import this places detail here  and now it's time to implement this particular   function in our location repository  implementation go here and Ctrl I yes   now we are going to use our places client so  we have places client here and yes we got a   function fetch place now fetch Place require fetch  Place request so we need to create that request   So within here I'm going to create a variable  naming request which actually store our fifth   place request now here we need to follow the  Builder pattern so pass your place ID under   second parameter in this Builder is places field  so the information which you require through this   API you need to pass in a form of list like I'm  gonna show you so we have here places list list of   and I'm gonna use my place field let me import  the place okay now you will see we have delivery   rating phone number address let along everything  what we need so we first choose our delivery   then I'm gonna choose my lat long then we  choose our uh what to say we have address and   we have phone number we have its let long  I think I already did that long yes I did   so apart from this let me check my places  detail okay we did name destination origin   is not available by this API deliberating yes we  actually get all the information yeah so keep it   very simple so remove all this thing so we require  this information from this API now it's time to   pass the places list okay so this is our request  now I'm gonna pass this request in our fetch place   and attach add-on success listener So within this  add-on success listener we're gonna get fetch   Place response and within this we have place now  it's time to map this place with our places detail   over here okay so in order to map I'm gonna create  a mapper package here right click new package   sorry right click new package mappers  and I'm gonna call this file laser mapper   within this I'm going to create a function place  to domain a return type would be Place detail return place details so we need to pass the  place ID so you know for now I'm gonna pass my   place ideas I'm twisting okay so we have name  so pass name here with the help of our place   object so we have place name or empty okay so we have destination so destination  is coming from our place this dot lat long   and we have origin so for the time being I'm gonna  initialize with the lat long zero comma zero and   zero comma zero okay so delivery is available or  not so in order to check delivery we use this Dot   delivery and we need to check it if it is  equals to place a Boolean Place attribute value   true okay first thing is the rating so rating  is also coming from this this dot rating   so it is a type of double so  convert it in a type of float   okay so if any case it is coming null  from our backend so I'm gonna give it   0f okay so this is a conversion of place to  place detail now jump back in your location   repository implementation and simply use these two  domain okay now I'm gonna use callback flow here and within this ad on success listener I'm gonna  use try send and simply pass this particular   conversion which we did okay now I'm gonna use  this switch place in our view model So within our   presentation we have screens and  within our screen we have places   and places search view model so here I'm  gonna create a function that spell fetch   details we need to pass the place ID type is  string and yes in order to use that thing we   first create our use cases and then inject that  use cases in our view model so come back in our   domain layer and here I'm gonna create a  use case for that so the use case name is   fetch restaurant details okay this is a class  and within this I'm gonna inject my Repository okay let me import this inject   and within this I'm gonna create a operator  function invoke within this we need to pass Place   ID because the requirement of our function which  is present in a location repository is places   ID so we need to call this fetch place and  simply pass our place ID here okay so this   is a use case for fetching the restaurant  details now in order to use this we have   to provide this in our domain module so here I'm  gonna use provide function provide a restaurant   details use case the requirement of this use case  is location repository and the return type is   fetch restaurant details return fetch  restaurant details pass your location Repository   okay let me rename this to use case now it is  more suitable name for our use case I'm going to   inject this fetch restaurant detail use case in  our view model so private well fetch restaurant   detail use case and within our function I'm gonna  use viewmodelscope.launch and call this fetch   restaurant detail use case requirement is placed  already so pass it and collect the latest emission   okay so I'm gonna emit this emission with the  help of Lambda here so I'm gonna call this   result and within this the input would be  Place result and this function will return unit   okay so I'm gonna use this result dot invoke and  password places details okay so I need to change   this to place detail sorry for that uh yeah now it  is good to go so this is a complete implementation   of getting complete details with the help of our  place ID okay so where do we use this so we are   going to use in our place search list item  so here when our user click on this text so   I'm gonna make it clickable and when user click  on to this I'm gonna use my viewmodel DOT fetch   details and pass our Place ID and when we receive  the result we simply navigate to our Google Maps   screen so this is a complete implementation of  getting the details complete details with the   help of place ID so now it is a good time to start  integrating our Direction API so Direction API is   used to find a route between our current location  to the restaurant so let's start integrating that   thing so for that this is our Direction API so  I'm gonna copy this and within our data layer I'm going to create a package and the package  name would be data source and within this data   source I'm gonna create one more package naming  Network and within this network I am going to   create our service so as you know we are going  to use a retrofit so retrofit require interface   that is implemented by him so I'm gonna call this  interface as a location service and within this   service I'm gonna paste my direction API so this  direction API contains some base URL so I'm gonna   copy the paste URL jump into my data module  and within this module I'm gonna create few   annotations so that we we will distinguish between  our normal string and our Google base I URL thing   so in order to create a custom annotation you  are you are going to use qualifier and within   this qualifier we have retention and within this  we have annotation retention runtime that I will   consume and here I'm gonna create my annotation  class so this thing will call Direction API base   URL okay just like this I'm gonna create one more  annotation for our retrofit so qualifier retention   annotation retention dot runtime and this time The  annotation class name would be location retrofit okay now I'm gonna use these two annotation  here so first I am gonna consume my direction   API base URL so Direction API base  URL provide function provide Direction   API base URL okay the return type would be string   now simply return our base URL okay after this  I'm gonna create my retrofit thing so provide   Singleton and my annotation would be location  retrofit function provide location retrofit okay and this time I will use my direction API  base URL within this so in order to separate   the normal string and this particular base URL  we are going to use our Direction API base URL   thing and I want to call this string  and the return type would be retrofit return a retrofit Builder here we have our base  URL which I pass here and we have our converter   Factory so I'm gonna utilize Json converter  Factory dot create and yes lastly I'm gonna build   this okay now I will provide the implementation of  this location service so provide location service   inject our retrofit here and the  return type would be location service import this location service and I'm  gonna return the implementation with   the help of retrofit We Are Gonna Write the  implementation for this location service   class dot Java okay so  that's it for the module part   now I will come in our location service and here  I'm gonna create a suspend function get direction and within this I'm gonna create this thing with  kit because this is a get request import this kit   now from https to googleapis.com is  a base URL rest all the thing is our   end points so I'm gonna copy this endpoint from  maps to Json and paste here apart from this you   will see we have few queries like we have  origin we have destination and we have our   API key so I'm gonna create few queries for that  so we have query the first query is our origin type is string then we have second  query which is for our destination type is also string and lastly  we have our key API key basically   key type is also string at the return type I will  give you a Json response which is coming from   Direction API so this is a response which I will  give you in my GitHub repository so you will copy   all this thing and create a model which is purely  reflecting this Json So within our model right   click new use kotlin data class file from Json  paste here and call this direction API response   okay so it will generate a lot of  classes for you and use this thing in our   location service so we have Direction API response  okay that's it this is all for the integrating   thing now we are going to utilize this location  service in our repositories so go to your domain   layer repository So within your domain layer we  have our repository and within this Repository   I'm going to create a suspend function naming it  Direction and within this the required thing is   starting point which is a type of light long  second we have Destination type is lat long and   lastly we have API key and the return type of this  thing is detail not detail its direction detail   so Direction detail is a domain layer  model so I'm gonna create this thing   naming Direction details so this is a data  class and within this data class the first   parameter is points which basically contain  the mutable list of light long and we receive   this thing from our Direction API and I'm  gonna slice this thing with mutable list off second is distance so this thing is also coming  from our API then we have duration type is string   and lastly we have HTML so this will show us  the Turning Point uh basically it will give   you direction from where you need to turn from  where you need to move right left and whatever so   it depends on your route so this HTML is also  coming from our Google API or Direction API   So within our location repository I'm gonna  import this direction detail because it is created   and time to implement this thing within  our repository implementation so go here   and implement this thing so in order to  implement get direction we need location   service so inject that location service within  its Constructor so private well location service   and when you change the Constructor you need  to also change within its module So within its   module here we need to use our location  service and pass within its Constructor okay so one more thing I I forgot to add within  its uh within our retrofit I'm gonna use location   a retrofit in order to distinguish between  our normal retrofit and this location retrofit   okay so now within our implementation  part within our get direction I'm gonna create few strings so  string first is start light long   this is a type of string so I'm using Pay string  empty string and within this empty string I'm   gonna use my start latitude comma start longitude  okay duplicate this thing just like this we have   our destination let long so destination light long  and replace this start with destination light long okay now I'm gonna use my location service dot get  direction and in place of origin I pass my start   latitude longitude in place of destination I pass  my destination alarm and in place of key I pass my   key you pass your key okay so the return type of  or you can say the response from the repositories   Direction API response so I'm gonna use mapper and  map this direction AP response to our Direction   details so in order to do that go to your mappers  and within your mappers create a extension   function over Direction API response to domain and  return type of this function is Direction details create object of this direction detail and for  our points use polyline util decode and here   you need to pass the path which is coming from  our Direction API So within our Direction API   response we have a route select the first route  because first route is more accurate okay now   within this you will see this over view polyline  okay use this and within this you got a point   so pass this point within our poly util.d code  so it will basically decode all the string and   return you the mutable list of latitude and  longitude which we are gonna consume in our screen   okay so apart from points we have distance so in  order to use distance choose this route select   the first element and within this we have Lex  select the first one and within this leg you   will see we have distance we have start address  we have addressed address so we have everything   so I'm gonna use distance and convert this thing  in a form of string like this we have duration   this route choose the first element because first  element is more accurate that is why always choose   the first element which is coming from our API  okay within this route first element we have legs   choose the first one and choose the duration okay  this route first element we have let's select the   first element within this array or list and  within this we have steps okay select the   first element within our step and here you will  see HTML instruction which is which is a form of   string so use this ok so this is a conversion or  you can say mapping from Direction API response to   Direction detail now I will use this within our  implementation so we have Wall response now I'm   gonna return this response to domain and that's  it this is a complete implementation of our get   direction API okay it is time to create a use  case for this direction thing so within our domain   layer use case right click and create a class that  will say itself get direction use case this is a   class and within this class I'm gonna inject my  repository so private well location Repository   and within this we have operator function invoke  and the parameter for this is started starting   point which is a type of landlock lat long we  have destination type is light long and lastly   we have API key string and I'm gonna use flow  Builder here and within this flow Builder I am   going to pass my type so my type is UI event and  within this UI event we have Direction details   so UI event is not created yet so I'm gonna create  this thing within our common module So within our   common module we have package events and results  so right click new create a sealed class naming UI   event okay so this is a generic class which is  a having type T and within this we have data   type T which is equal to null and second thing  is message type registry this thing is also null   and within this I'm gonna create  few classes so we have loading   type is T extend this with UI event  type is T okay like this we have success and in success case we received data extend  this thing with UI event and pass data and lastly we have error   type T and in case of error we got a error message  and pass that error message to our UI event okay so this is our UI event sealed  class so import this and within our flow   first I am I wanna emit my UI event loading  case then I'm gonna emit My Success case   and within the success we have data so use my  location repository get direction pass my start   destination and key and if anything goes wrong  here so I'm gonna cast that exception use our   UI event error class and pass the message so  message is equals to it message to string and   I wanna execute this flow on dispatcher  dot IO okay so this is our use case now I   will provide this use case with the help of our  module So within our location domain dependency   injection module I'm gonna write up provide  function provide function provide get direction   use case okay and uh parameter for this is  location repository return type is get direction   use case return get direction use case pass your  location repository so this is our use case Okay   so our use case is done now it's time to create  one more function within our repository that   is used to get the actual location update to our  screen so that we will update our camera position   our tilt our bearing and apart from this we also  update our route what are the remaining distance   we have depending on the user current location  so we require a function which is purely give me   the location updates that user is now here now  present here after some time so in order to do   that within our location repository I'm going to  create a function naming git low application and   within this I'm gonna pass a destination which  is a type of flat long and the return type of   this thing is flow and this flow is containing  location event now this location event is a sealed   class that I will create within our common event  and result package right click caught in class   slash file uh we have location event now this is  a sealed class and within this we have location so location which is coming from Android dot  location package and within this I'm gonna   create a class location in is progress  location in progress notice progress So within our sealed class the first class that  I will create naming location is in progress   so in this scenario we receive our location  and extend this thing with location event   and pass your location here okay and one  more thing initialize this thing with null   in initial case okay so we have one state where  we say location is in progress now second is   user reach to the destination so  that means a reach destination again extend this thing with location event  and pass nothing the last one is ideal case   so ideal location event so this is our location  event which contain three events the first one is   user in in location is in progress that means user  actually running towards our restaurant and the   second one is reached destination that means user  reached to its destination third one is ideal case   So within our location repository I need to  import this and it's time to implement the   algate location within our implementation part so  within our data layer repository implementation   I'm gonna Implement that function and start  implementing it so in order to implement   this thing we have use location product client  request location update now this thing require   two thing two thing a location request location  callback and your Looper so I'm gonna create   location callback so location call back type of  object location call back and within this we have   on location result so after I getting the result  the first thing I will change the name location   result okay now here we have current location  and within this we have latitude and longitude   so I'm gonna update this thing first  so we are going to use a light long   and within this I'm gonna use my location  result let it locations sorry locations get   latitude second one is our longitude so get the  first element and its longitude so our current   location is updated now we are gonna use callback  flow and the type of this callback flow would be   location event okay now within our on  location result I am gonna use try send   use location event and within this location  event we have location is in progress   and pass your location within this but  the problem is how do I know that we are   not present in our destination I mean we are  in the middle of our uh route how do I know   so in order to know that we are present in  the middle of our route or we reach to the   destination I'm gonna create one more function  so private function is reach to the destination   okay so here I need to pass my current location  and my destination so I say current location as   origin type is light long and we have destination  there is a type of light long and the return type   of this thing is Boolean okay so here I'm gonna  create a array which is a type of float array   contain only one element and  I'm gonna use my location Dot   distance between function and within this you need  to password start latitude start longitude and   latitude and longitude and you need to pass your  float array so in our in order to pass that we are   going to use our origin latitude we are going to  use origin longitude and apart from this we have   destination latitude and destination longitude  in place of array you simply pass your array   all right reformat it and you got  your result I mean the distance   which is present in your array that we  pass here so now if our array first element   is less than or equal to 5 F that  means we are present in our destination   so it will give you a True Result if it is not  it will give you false result so I'm gonna use   this is reach to the destination function within  our this particular function on location result   so if is reach destination so I want to pass my  current location and I want to pass my destination   if it is true that means we reached to the  destination otherwise we won't so I'm gonna use   else and within this else just pass this try send  and if we reach our destination then I'm gonna use   try send location event reached to the destination  okay in our location is in progress I am gonna use   my location result dot location and pass our  first result through through this all right   so we did everything we got our location call  back now it's time to create a location request so we have a location request Dot  Builder and within this you need   to pass the priority so priority is high  accuracy and interval is 100 milliseconds   apart from this we have to set up our interval  in release so I wanna use five seconds here   and yeah simply build it now use this location  request and location callback within our   request location update so here we need  to pass location request location callback   and I am not using any Looper so pass null in  place of Looper and when if everything is done   we are gonna use await close and use our fuse  location product line and remove our location   callback so remove location updates  and pass your location call back here   so this is a complete implementation of our  get location function which is present in our   location repository now we are gonna use this  thing within our view model or you can say   Google Maps view model so now we will create a use  case for this location thing so within our domain   layer use case I'm gonna create a class and that  class name would be kit location updates use case   and within this I'm gonna use Constructor  injection private well location Repository   and operator function invoke just need  to pass our destination type is lat long and I'm gonna utilize my location repository  dot get location Passover destination unit   okay so this is our very very very simple use  case for this location update thing now it is   a time to write our Google Maps view model  which we are going to use in our Google Map   screens So within our presentation layer we have  Google Map package and here I'm gonna create my   Google View model okay so this is a class and  that class extend with view model annotate   this thing with Hilt view model and I'm  gonna use Constructor injection here so   inject Constructor private well so basically  we have to use cases the first one is used for   location update and the second one is used to  get the direction route basically so we have   get location update use case privateware  get directions use case now I will inject   these two within our view model now I am gonna  create one function and that function name is   get location updates here I'm gonna  pass my destination type is lat long   and within this I wanna use my get location update  use case pass my destination and start collecting   the latest changes so because this thing is  executable only the only within our code and   scope so I'm gonna use my viewmodel scope dot  launch and put this thing within our code and   scope now it works well so in order to store the  location event I am gonna create a private file   current location type is mutable State  flow and the type is location event okay notable State flow and I'm gonna use  location event dot ideal for its initial value   and within this we have current location  that we are gonna expose to our map screen   this is a type of State flow location event get  current location okay so I think this is a wrong   okay now it's good so this current location  is actually telling us the current location   so I'm gonna use this variable  here and store the current value   the second function is actually used  to get the route so get directions   and within this I wanna use my get directions  use case and the requirement of this particular   use case is start Point destination point and  the API key so I'm gonna pass start type is   light long we have our destination and lastly  we have our key type is string now simply pass   everything here so we have start destination  and key okay so after getting the result   you will collect the latest emission because  this correct latest require a coordinate scope to   execute so I'm gonna use my viewmodelscope.launch  and put everything within this all right so now I will create a variable  private while underscore or route points   type is mutable State flow and we have  here Direction details so this thing will   contain the direction details and initialize this  thing with mutable State flow Direction details   we have variable here which we are  going to expose to our Google Map screen   route points State flow type is Direction details  and simply update this thing with upper one   okay so now this route point is  gonna update with our latest emission okay so all right so here we have UI events so  we need to check its type so when it is loading error or success so we have loading we have  error we have success so during the case of   success we are gonna update this thing  okay so it dot data which is not null   yes so this is a complete implementation of our  Google view model now this view model is used in   our Google Map screens to implement our Google  Map screen so go to your presentation module and   within this presentation we have Google Map screen  now within this Google Map screen I need few   parameters like nav host controller and I want my  view model and lastly I want a place details which   we had already faced with the help of places API  within our places screens okay so now I'm gonna   pass that particular details from places screen to  our Google Map screen so go to your place screen   and here if you remember we attached a click  listener to our list item over here okay we got   a complete detail based on the place ID and after  getting the result we invoke this particular land   expression so what I am going to do I'm gonna  update our place detail origin so it origin is   gonna updated with the help of light long and the  latitude and longitude that we receive within our   places result I am going to utilize that thing so  we have places result location not list location   and we have latitude just like this we have  places reservation dot longitude okay so we   successfully updated our place details origin this  is because during the mapping in our data layer   we simply use latitude longitude 0 comma  0 and 0 comma zero to set our origin   now it's time to update that thing because  in our Google Map screen we want that origin   or the starting point so that is why I am  gonna update this thing okay now it's time   to pass this particular information so  in order to do that I'm gonna create a   Lambda expression go to Google Map okay this is a  function and within this function I'm gonna pass   my place details is information and return type  is unit now I'm gonna utilize this particular   function within our clickable event go to Google  Map invoke passive place details now go back to   your internal location feature API and within  this feature API we have our restaurant finder   screen now I'm gonna open a pair of parentheses  and here you will see we got our information   place details now it's time to pass this thing so  in order to pass this thing I'm going to use my   Naya host controller and its current back stack  entry and in which we have Save State handle and   I'm gonna set our information to this particular  Save State handle so this thing require a key so   key is place and information is it but in order to  use this approach you first make this particular   place detail Parts label so that it is possible  otherwise it won't be possible without making   this place detail Parts label so I'm gonna use  my place detail data class and I'm gonna use in order to make this thing Parts label import   this now it's good go to your internal  location feature API now we simply set   our place detail information within  our Save State handle now within our I'm gonna create a variable place and use nav  host controller dot previous back stack entry   we have Save State handle and I'm gonna get  the type would be place details and keys place okay so we receive successfully our place  detail which we attached to our current back stack   into Save State handle which is a previous back  stack entry with respect to our Google Map screen   okay so after getting our place detail  I'm gonna check whether it is null or   not if it is not null then I will call my  Google Map screen composable within this   okay so now the parameter that I need to pass  within this Google Map screen is nav host   controller and our view model so V model is not  created it so I'm gonna create a simple view model   Hill to view model and the type of this view  model is Google view model simply pass that   view model and lastly you need to pass your place  details okay so now we have Google Map screen and   within this screen we have our place detail  information so basically we have a starting   point we have destination we have restaurant name  we have deliveries available or not everything we   have in this particular screen so now it's time to  implement our Google Maps this I'm going to create   few variables that I will consume within this  function so the first variable is current location   that is in slice from our view model current  location and I'm going to collect this mutable   state in a form of State second one is our route  which will contain the information of our route   a view model route Point again I'm gonna  collect this thing in a form of State   and I require one more variable which basically  contain the information of our destination and   that is coming from our place details all right  so after getting all this information I'm gonna   use launch effect execute this particular  launch effect for once that is why I use key   as a unit now within this corrupting scope  I'm gonna call our view model get location   updates function requirement of this function  is our destination all right so as you know   current location is basically a sealed class  that contains three more class in it so that   means I'm gonna use one expression here our  current location value has a type of ideal second is in progress third  one is reach to the destination   so for the time being I am working with this  location is in progress state So within this   state I'm gonna use my current location value and  we have location I'm gonna check whether it is   not or not if it is not none then I'm gonna  execute this block call this thing location all right so the thing which I'm gonna do  within this block is a camera position up   state so remember camera position State and I'm  gonna open a pair of parentheses within this we   have position and that position is updated with  the help of camera position so I'm gonna update   our position with the help of camera position we  use its Builder now we have few parameters that I   want to show you an image and on that image I will  explain you what are the things like we have zoom   uh we have bearing and we have tilt  okay and lastly we have our Target   and simply build it okay so I'm gonna tell you  about Zoom about bearing about tilt about Target   so just look into this image okay so this is an  image uh the the plane is representing our Earth   we have a Target so here you will see this  is our Target and this is the intersection   of our perpendicular which is coming from our  camera so you will see this one okay so this   is a perpendicular to our plane from camera  and the angle is subtended from this axis   to the Target okay so the line from camera to  our Target so this will sustain some angle from   this perpendicular that is called tilt okay so  when it's come to bearing bearing is an angle   that is substanded from our North Pole and our  Target from this intersection Point like you will   see over here so this angle is called bearing  now I think you got what I'm trying to say and   if you don't got don't worry I will put this uh  link to the description go and check everything   by yourself uh by the way it's very easy if you  don't understand I don't know why you you don't   get it it's very easy and when it's come to zoom  in the bottom you will see the zoom so the value   of this Zoom representing if you put one it  will show you the whole world if you put five   it will show you land mass continent if you  put 10 it will show your city I Street for 15   a building for 20 okay so within our application  uh the zoom level which I prefer is 17f okay now   bearing is something which is coming from our  location so I'm gonna use my location bearing   and I will use tilt 45 degree and when it's come  to Target so I'm gonna use again my location but   this time I will create a object of light long  use my location latitude and my location longitude yep so I have successfully updated my camera  position in initial phase okay now what will   happen if we update our position current position  like if I present uh on zero zero comma zero now   if I move to uh zero comma 1 or 0 comma two  whatever so how do I update my camera position   so in order to do that uh I'm gonna use my camera  position animate and within this animate we have   update so we are gonna update our camera position  with this camera update Factory so we have camera   blade Factory and within this we have new camera  position okay and the second parameter within   this animate is the duration okay the animation  duration so I'm gonna choose one seconds okay   so now within this new camera position just click  Ctrl P you will see it require camera position so   just create a camera position like we did already  so camera position uh instead of doing that I'm   simply copy this thing and paste over here so copy  this paste over here okay so everything is fine   all right so this is a way using which you  will animate your camera and update your   location sorry update your camera based on  your location so this animate is a function   that will execute within a quotient scope so I'm  gonna create a scope for that so while let's go remember core routine scope and I'm gonna utilize   that disco here so let's go launch  and within this I put all this thing okay now we hit our initial phase of camera  position uh we did if our location gone update   then we update our camera position now we also  need to show the polyline in our map like from   current position to the restaurant we want to  show the polyline so in order to do that I'm gonna   use my launch effect and this launch effect is  basically based on our current location value if   our current location value change on the location  we are going to execute this block and within   this block we have a view model get direction so  basically this will provide you the route points   and within this we have start so within  our start I'm gonna use my lat long   uh we need to pass our location latitude here  and location longitude here and we have our   destination so in place of destination  just pass your simple destination oh sorry I passed my destination within this  uh latitude and longitude so sorry for that password restoration over here and lastly you  need to pass your key so I pass empty string   cool so based on our current location if our  current location updates updates every time   we trigger this get direction now if our route  is updated so we need to update our polyline   so in order to do that I'm gonna use again  a launch effect and in this time I'm gonna   use my route value if this route value will  update so on the location I'm gonna first   update my camera position and then  update my Google Maps polyline so   which I will create I'm not getting that  thing yet so I will create that thing too   okay so everything is done now within this  launch effect I'm gonna use Google Map   now requirement of this Google Map is modifier  so I'm gonna use modifier modifier fill Max size   and we have our camera position so camera  position is coming from our camera position State and within this camera position State I am  going to send my camera position which I created   over here okay now open up here of parenthesis and  within this I'm gonna attach my polyline so poly   line requirement of this point line is points so  the point is present within our route value points   apart from this we have its width  its color so I'm gonna use color blue   not black it's blue and lastly we  have width so I choose 20f width   Okay cool so now everything is done so the thing  which is left from my side is the connection from   this place is search to this screen so in order  to do that go to places search here within our   clickable events which is present in our list  item I'm gonna navigate from this screen to   another screen so I need our host controller so  go to your internal location feature API and pass   your nav host controller from here go back to  your places search and within your controller now I'm gonna use that thing just below to our  Google to go to Google Map invoke so I'm gonna   use my nav host controller and navigate  location routes dot Google Maps dot route   all right so connection is also done so this  now it's time to execute our application   everything is done from our site we have Google  Map screens which is perfectly fine uh it's time   to check whether it is running exactly what  we expected or not so let's run this thing   all right so during the execution of our  application I found few issues which is   purely related to our plugin this is not our  issue so here it will create a step data class   and within this we have duration of type duration  X so actually it will create a duration type but   here I don't know why it is creating object  or duration X or end location X so remove   X from these objects and simply execute your  application application executed successfully all right this is our search screen  so I'm gonna click on this three dots and it will open this interface So within this  interface you select location and within this   single point tab you're gonna choose  any location which is very near to you   I am choosing this one and set my current location  of the simulator to this cool now I'm gonna type a   restaurant which is very near to me so kishori is  a very near restaurant from my current location so   I'm going to type this and there we go we have  this restaurant I'm I'm gonna click into this   and yes this is a route now I am going to  start moving to this restaurant so I'm gonna   play my route so here you will see we have  a route tab click on this route and you need   to search the kisori so I got this Kishore  restaurant click into this start our route   go back to a single point again select this  location copy the location address from here   go back to your routes and  put it your start destination   all right now choose your speed it's up to you  so I am gonna choose 2X and play my route so it   will update our location and based on that  location our route is also start updating okay so the difference which you see is  actually present because I start my route   routing from bhagwajungi which is uh more near  to the restaurant and my current location is   more far so that is why it will start from the  middle of this route so there is no problem   with our logic our logic is perfectly fine uh  there is a few issues regarding this route so   that is our case okay so when I reach to  the destination it stopped the execution just wait for it I'm gonna  increase the speed to 4X okay so this is the use of bearing actually  the camera is present just uh behind you   and all of this camera moving part is handled by  our bearing so that is why bearing is so important   all right so we successfully reached to our  destination okay so this is a thing which we have   done it perfectly so now it is a time to insert  all of our place detail in our local database   so in order to create a local database uh we are  going to use a roon database library for that that   app database present in our application module  now this is because application module knows all   of our future module so any data subject which is  specific to any feature is available in app module   and by doing this we are really easily provide  all of the implementation for the taxes object   and apart from this with the help of dependency  injection we also provide the data access object   to our application so that we inject anywhere  we need like fragment activity use cases so now   it's time to write our app database So within  our app module I'm going to create a package app database and within this app database I'm  going to create a f stat class naming app database okay extend this with room database and make  sure to convert your normal class to abstract   and annotate this with database within this  we have entities which we are gonna insert in   our room DB so in my case we have Place detail  need to pass our version code which is version   number which is one and I don't wanna support my  schema so I'm gonna use export schema as a false   within this I'm gonna create a companion object  and within this I'm going to create a function   get instance pass context here import this context return  type would be app database   return room database Builder pass your context  your database type and your database name so I   just simply call DB and I don't want to write any  migration so I want to use fallback destructive   migration and simply build it okay so this is  a normal App application database in our case   go to your location feature domain layer and  within this I'm gonna create a package that   package name would be a room and I'm gonna create  a interface or you can say data access object   so location dial this is an interface and  make sure to annotate this interface with Dao   okay so I'm gonna use suspend function insert  which we use to insert our place detail   and make sure to annotate this  with insert on conflict strategy   replace so that it will replace the older  primary key if we have two data or two record   which have a same priority then the older one  is replaced by the newer one and the second   one is query which is used to get all of our  information from DB so select asterisk from place details okay and I'm gonna use flow here  so don't use suspend keyword before function   get all place details a return type would be a flow make  sure to import the correct one   and within this flow it will contain list of  place details okay so now it's time to convert   this place detail normally to class to entity  so I'm gonna use this place detail in form of   entities so in order to do that first thing first  you need to use this rotation entity over our data   class and second thing every entity has a primary  key so I'm gonna use Place ID as a primary key and   make sure this Auto generate is false so that  our room DB does not create a privacy by itself   okay so we have a location down now it's time  to write implementation So within our app DB   we are going to create abstract  function get location down   so the implementation is written by our room  Library we don't take care of this thing   so location down okay so now it's time to use  dependency injection and provide all this thing   so our database is single so Singleton provide   function provide our app data base  requirement is application context a return type would be our appdb so a written  app database dot get instance pass your context   okay uh just like this I'm gonna create one more   function which provide our location down so  provide location down requirement is app database   location now a return app  database get location down   all right so everything is done regarding with our  room DB setup all right only one thing is left and   that is in our place details you will see we have  light long objects so see in our room DB we only   save uh primitive data types it is not possible  to save any complex object just like this this lat   long and if any anything which is not a perimeter  type it is not able to save in our records so what   we need to do we need to write type converter  for that so what we do we simply convert this   light long into string and then store in our  own DB and when we get all of our objects then   we need to convert this string into lat long okay  so for that we need to write few type converters   so I'm gonna write below to it  so class let long type converters and within this we have function the first one  is convert any string to light long okay string   string return type would be lat long I'm gonna  use Json here uh with this Json we have from Json   so you need to pass your string and the type so  let law class dot Java and the second function   is let long to string so pass your let log within  this function and the return type would be string   Json dot to Json and pass your lat long okay so  this will convert let law into string now in order   to tell our room DB that this is type converters  so you need to use type converter annotation okay so now it's time to register this type  converter within our application database   so we have one more annotation for that type  converters and you need to pass your light long   type converters class that's it   all right so now it's time to go back to your  location feature domain layer and write few use   cases create a class and that class name would  be get all place details from local DB use case   So within this I'm gonna inject my data  access object so private well location down and I'm gonna use operator function  invoke and use my location down get   all place details okay just like this we need  to create one more use case for insertion so   insert place details to local DB use case okay  inject Constructor private while location down   and I'm gonna create suspend function  so invoke so I need to use operator here   operator suspend function invoke need  to pass our place details and I'm gonna   use my location down insert and password  place details okay so need to sort this one   yeah cool so by doing this we actually write all  of our use cases now it's time to provide these   use cases within our domain module so provide  function get all place details from local DB   okay and it will provide basically  get all placed detail use case so   return get all placed detail use case  you need to password location now just like this we need to pass our other use case  so which is uh insert Place detail use case again   requirement is location now and the return type  is insert Place detail to local DB use case return   insert Place detail to local DB use  case and pass your location down   so now it's time to use these two use cases in  our presentation layer so go to your presentation   layer and here within our screen we have Google  Map go to your Google view model and first thing   just use private while insert Place detail  to local DB use case and create a function   insert place details place details I'm  gonna use my view model scope.launch   and after that I'm gonna use my insert Place  detail to local DB use case and pass my place   details okay so this is uh by doing this  it will store our place detail in room DB   okay so now it's time to use this thing within  our Google Map screen all right so when we reach   our destination I'm gonna use view model  insert Place detail and pass our place   okay and after that I'm gonna use a toast message  so toast dot make test I need to pass a context so   I don't have context within this composable so I  need to create context context uh local context   dot current now I wanna use that context here I  need to pass message that reach to the destination okay so you need to pass the duration so which  is toast dot length long and simply sew it all right and after that I'm gonna use my host  controller and I want to pop -up stack and I   need to pass my destination so my destination  would be this place search this one place search   so here if you see in our composables we're gonna use this location route  so we have location around Google Maps dot route   we have location route places search route so  I'm gonna use this places search route and go   to your go to our Google Map screen and pass  here okay so this is our route so need to check   so you can pass your route the second one  is inclusive so yes I wanna pass this true   because I want to remove the Google  Map screen and places search screen   from our back stack okay so that is why I  am passing this inclusive is equals to true   all right so our when we reach to the destination  we simply inject or you can say save our   all of the details for the destination in our room  DB now it's time to use that information and show   to our user on our dashboard screen so go to your  dashboard feature and here we have presentation   now this presentation doesn't know about location  domain layer so we need to connect that so here   within its build dot griddle I'm  gonna use location domain and sync it   go back to our dashboard feature presentation  and within this I need to create view model   so I'm gonna call this home view model this is  a class and this class extend view model okay to view model and I'm gonna use inject Constructor  private well get all Place detail from use case   and simply I'm gonna create a variable list and  use this get all Place detail from local DB use   case okay yeah that's it now it's time to use this  list within our home screen So within our home   screen I'm gonna uh pass nav host controller for  view model these two things okay so now it's time   to use this home screen within our navigation  theme internal dashboard movie API so here   within our home screen with two parts two  thing nav host controller and the home view   model so we already received this thing and  home view model is not created yet so we need   to create one so home view model this is Con  generated with the help of Hill to view model   you need to pass our type which is healthy  model and pass your home view model   okay yeah that's it this is all for our navigation  setup now go to your home screen uh within this   home view model we have list so I'm gonna create  a variable again calling this thing is list   home viewmodel dot list dot collect as date okay  and when it's come to initial just pass empty list   yeah that's it so I'm gonna write my UI then   so I'm gonna use scaffold and here we  have top bar and within our top app bar import this top above and within this  top paper I'm gonna give title as a text home page and apart from this let me just  reformat it apart from this we have actions   and within this section I'm  gonna create a icon button   so we have on click and within this  I'm gonna use the icon import this icon   uh I'm gonna use this image vector1 so icons dot  default dot search and the content description   is null all right so yeah that's it for our top  app bar so this topic bar is experimental API   so I need to add this annotation on the top  all right so I'm gonna use locket to remove   this error this is because we don't use padding  values so that is why it will give me an error   okay so now it's time to check if our list  value is empty or it is not so if it is empty   I'm gonna create a box modifier fill Max size  content disk content alignment is on the center   and within this I'm gonna create a text that  no destination found import this modifier okay so this is a case of when we receive a  empty list okay and when we don't receive IMT   list then I'm gonna create a lazy column and  within this lazy column I'm gonna use items   and with these items pass our list value let me import these items okay so now we receive one  by one the our place details   so we need to create our list item so  I'm gonna create a location list item and the input of this thing is place details  so I'm gonna create this composable below to it   location list item and the input would be  place details okay and within this I'm gonna   create a column so modifier modifier  fill Max width and padding is 12 DP   okay and within this I'm gonna create a few text  and few spacers so the first one is text this is   our starting point so we got starting point from  places detailed origin latitude and its longitude   so it origin longitude then I'm gonna use  spacer modifier and I'm gonna use height of a DB   all right so just like this I'm gonna show you  the ending point or you can say destination it dot destination dot its latitude and its  longitude so it dot destination it's longitude just below to it we want some space so I'm gonna  use modifier its height would be 8 DP okay then   again I'm gonna use text and this time I'm gonna  use it dot it's name okay and on the starting I   will call this thing as name again spacer  of 8 DP so modifier we have height of ATP   again we have text and we're gonna check our  it dot uh we have a rating here so ratings   which is coming out of five and on the start  we call rating again I'm gonna use spacer give height of 8 DB again a text so this time the  text would be a depend so if our it dot delivery   if it is true then we call we  call this a delivery is away level if it is not then no delivery away level okay again I wanna use space modifier height of 12 DP and we should also use this spacer on the top okay  so this is our location list item and this is our   simple very simple home screen okay so now what  will happen if we click in our icon button then   I want to use my nav host controller navigate  here yes it is available so location route   uh uh places search route so basically uh  when we click our search icon we simply   navigate to places search okay so this is a  very simple use case of this nav host controller   all right so now go to your app did application  module navigation and here we have main navigation   in our main navigation we need to change this  uh location route so click on this you will   see we have dashboard we have location  so now it's time to set up our dashboard   so go to your main navigation again and just  convert this location to dashboard so that our   first screen would be uh dashboard screen instead  of our places search screen okay so yeah that's it   now it's time to execute our application and check  whether it is properly working or not and if any   error will be occurred then we will solve together  nobody power app executed successfully this is our   home page and when I click search icon uh we will  reach to our process search screen so first thing   I execute this application for the first time  then we need location permission so I'm gonna   give this permission and after that I will click  on this three dots which will open this UI and   by using this location thing you will update your  emulator location so I'm gonna update my current   location of the simulator and I will choose set  location so it will update my current location   and here I'm gonna type kisori so it will give  me the Kishore restaurant I hope it will give   and there we go we have kishori restaurant  Bella pratapgarh up India so I'm gonna click it   and it will start the direction API it will  call Direction API establish a route from   kisori Southern to the kishori restaurant and  there you go you will see all these all the   direction thing over here okay so now again  I'm gonna open this and I will create a route   from this point from our current location to the  restaurant so I already did this from uh before   executing the application so this is our  route and I'm gonna start routing okay so it   will start route routing toward our restaurant  so just like this it will update our UI also   so after we finish our execution the information  is Gonna Save in our room DB and will again   reach back to our home page so wait for the  moment when we reach toward our restaurant so I'm gonna increase the speed  5x so that it will move quickly okay now I'm gonna reduce my speed so we successfully reached the destination that  information gonna saved in our room DB that is   reflected in our home page okay so I did more  changes in order to get this kishori restaurant   name and this rating so that changes were over  here so here I need to add these two field so   that I got the name and rating and one more thing  when you open this two domain function you will   see I update this thing with the empty string  so what I need to do okay so I'm gonna control   click over here so it will tell me I'm gonna  use this thing over here and within this two   domain function I'm gonna pass my place ID okay  this place ID which we received from our uh use   cases so I'm gonna call this and over here I'm  gonna create a parameter Place ID which is a   type of string and yes it may be null for some  time for few times not sometimes so I'm gonna   use my place ID or if it is null then I'm gonna  use empty so or empty okay now it works fine   okay so by doing this you will update your  place detail ID so if you have a different   ID then you have a different entity in your room  DB okay so that is why I will update my place ID   all right so that's it this is all for this  video I think this video is very long and   at the same time it is very informative  for those who never did multimodalization   I never use Google Maps and never use Locus  and all these steps so yeah this is all for   this video and if you have any query anything  which I left during this flow then you will   you will told me everything in the comments  okay so thank you for watching this video if   you watch this full video then thank you are  for believing me okay so bye and happy coding
Info
Channel: Vision Android Hindi
Views: 5,207
Rating: undefined out of 5
Keywords: #AndroidDevelopment, #RestaurantFinderApp, #GoogleMapsSDK, #PlacesAPI, #DirectionAPI, #LocationServices, #ModularizationInAndroid, #CleanArchitecture, #BuildGradleDependency, #NestedNavigation, #MVVM, #CallbackFlows, #MutableStateFlows, #DependencyInjection, #RoomDatabase, #TypeConverters, #AppDevelopment, #AndroidStudio, #KotlinProgramming, #softwareengineering, #android, #kotlin, #jetpackcompose, #vision_android, himanshu_gaur, vision_android_hindi
Id: H3jwJK9XdW4
Channel Id: undefined
Length: 161min 48sec (9708 seconds)
Published: Mon Jun 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.