last day (15 days later) » 

5:40 AM
0
Q: How to get location from firebase and animate the car marker

Pitchai MariI have stored location into firebase as latitude and longitude. now i want to fetch the value of those and with help of that, car marker should be animated like car moving. so i did car marker animation. but it will show only for current location. i want for firebase location it should show anima...

 
You have to insert the value each time car changes the location. but according to your code it might be retrieving the same exact value again and again
 
could you please give me a code help
 
i haven't familier with onLocationChange code but if you provide me proper code when user change location and get his lat and longitude then i can help you in proper way
 
ya sure i will edit my question
i have edited my question. if need more clarify i will ready to modify @Ashish
 
does this work mLastLocation.getLatitude() properly ?
 
5:40 AM
very sorry i forget to add this line. mLastLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApi‌​Client);
 
on
ok
but your mLastLocation is currentL right ?
 
its fetching current location
yes
 
so it's working as expected right ?
 
i want my firebase location should displayed
 
ok
then let me help you with this
 
5:41 AM
ya sure
 
ok last question uid this on which uid is this ?
current user or car ?
 
current user
current user of uid
 
then provide a code of car changing it's location
which one's location you want from firebase
i am quite confuse with this
cause i think you need car location keep changing right ?
 
like im doing car tracking system. so when user takes car his location im storing into firebase
from admin side im tracking his location
 
ohhhhh
means your keep on tracking users location
each time when he is inside car ?
 
5:45 AM
his location will frequently change when car is moving
yes exactly
so from admin side im tracking his location with help of stored latitude and longitude]
 
you have change those values each time
when user changes his location
 
yesss
 
but your code only showing retrieving part of those values
 
bcz stored location has done already
you want car changing location
code
 
wait
 
5:49 AM
okk
sure
 
is there any code of user take car ?
something like this
your differentaiting the user walking and take car location ?
 
even if he is walking als his location will be changed and stored into firebase
means user current location will be updating
 
ok
```@Override
public void onLocationChanged(Location currentL) {
mLastLocation = currentL;
setUserLocation(currentL);
displayLocation();
}

public void setUserLocation(Location location){
HashMap<String, Object> updateFbDb = new HashMap<>();
updateFbDb.put("Longitude", location.getLongitude());
updateFbDb.put("Latitude", location.getlatitude());
loc.child(uid).updateChildren(updateFbDb);
}```
test this code
just check your database structure
and change the key of hashmap
 
may i know why we need to update user location
i think user location updation succesfully done on client app
 
6:10 AM
we have to keep update the values from firebase when user changes his location
 

last day (15 days later) »