Android Get Current Location Continuously | Location Service | Fused Location Provider API

  Рет қаралды 37,626

Chirag Kachhadiya

Chirag Kachhadiya

Күн бұрын

Пікірлер: 137
@vinitpatra7462
@vinitpatra7462 2 жыл бұрын
[Important] Android permissions is updated and for API 29 or higher, "ACCESS_BACKGROUND_LOCATION" permission is required as well along with FINE and COARSE location permissions.
@adityasinghrajawat7344
@adityasinghrajawat7344 4 жыл бұрын
Very Good!!! But just a suggestion for you......You should speak while making tutorials.
@Nags343
@Nags343 5 ай бұрын
Thanks a lot it worked
@rahul08yadav
@rahul08yadav 4 жыл бұрын
Thank You Sir. You code so clean please continue making such video and try to add audio explanation if possible. You really helped me.
@AmanKumar-ec6bz
@AmanKumar-ec6bz 2 жыл бұрын
thanks bro save my time
@sachinmurkuteshorts
@sachinmurkuteshorts 3 жыл бұрын
06:19 to 06:21 there is a problem in the code line numbers maybe you imported something but the video does not show that
@WolfSkinFull
@WolfSkinFull 4 жыл бұрын
Огромная человеческая благодарность!
@pushanpaul1305
@pushanpaul1305 3 жыл бұрын
So far the most helpful location update video
@bodieernest6546
@bodieernest6546 3 жыл бұрын
I know im randomly asking but does someone know a way to log back into an Instagram account? I was dumb forgot the login password. I would appreciate any help you can offer me.
@dravenomar4032
@dravenomar4032 3 жыл бұрын
@Bodie Ernest Instablaster :)
@bodieernest6546
@bodieernest6546 3 жыл бұрын
@Draven Omar i really appreciate your reply. I found the site thru google and Im in the hacking process now. Takes quite some time so I will reply here later with my results.
@bodieernest6546
@bodieernest6546 3 жыл бұрын
@Draven Omar it worked and I finally got access to my account again. I am so happy! Thank you so much, you saved my account :D
@dravenomar4032
@dravenomar4032 3 жыл бұрын
@Bodie Ernest glad I could help :D
@akshayrajput1586
@akshayrajput1586 3 жыл бұрын
how this app is getting location in the background when we allow it "only while using the app" location permission also, I have noticed that it's not getting location in background after few seconds
@noormohammad8859
@noormohammad8859 3 жыл бұрын
nice work.. very workfull
@didieralejo
@didieralejo 2 жыл бұрын
Great job! Thanks for your explanation, it was very helpful.
@hexafgamer
@hexafgamer 3 жыл бұрын
its perfect bro thank you so much.
@HardikPatel-zp3hc
@HardikPatel-zp3hc 4 жыл бұрын
I have created tracking app which runs perfectly in android 7 in background but not running in 8+ Any solution?
@txt.girl.official
@txt.girl.official 3 жыл бұрын
Excellent...
@nickolajarjous2639
@nickolajarjous2639 3 жыл бұрын
great tutorial
@bhagyshrikadam7088
@bhagyshrikadam7088 4 жыл бұрын
thank you sir
@jigin100
@jigin100 3 жыл бұрын
Thanks for the turorial. It helps me a lot on my project.
@officefineoutput379
@officefineoutput379 4 жыл бұрын
Useful Tutorial
@muhammadabdullah3181
@muhammadabdullah3181 3 жыл бұрын
Good job Man 😊
@m-coders
@m-coders 4 жыл бұрын
Thanks sir Its very helpful to me
@jithendrasai
@jithendrasai 4 жыл бұрын
nice tutorial, bro
@MrZiko1975
@MrZiko1975 4 жыл бұрын
Good job! But it's not fully completed, we have to get result in activity/fragment/custom view. What channels do you use for that? EventBus or something more modern?
@chiragkachhadiya
@chiragkachhadiya 4 жыл бұрын
You can use intent service or local broadcast manager as well.
@danny_phantomwalker8418
@danny_phantomwalker8418 3 жыл бұрын
I have a question - Instead of getting Lat n Long in Log.d, can u show me how to display it on the app screen in Textview? I can't seem to get it done correctly. Other than that, great tutorial, Just wish you would explain, atleast as notepad writings or something. Thanks for the video!
@ziedorabi7534
@ziedorabi7534 3 жыл бұрын
I'm stuck at this as well , any progress ?
@kadirbozkurt2412
@kadirbozkurt2412 3 жыл бұрын
@@ziedorabi7534 did you solve? if you did please tell me how
@jaa70
@jaa70 4 жыл бұрын
Sir, thank you very much !!!, one question: if I restart the phone, the app will start too? if not, how can I get that ?
@amenmoipushi8821
@amenmoipushi8821 4 жыл бұрын
Set a broadcast receiver to know when the phone has been rebooted then if it has, start the location service.
@thangphamduc4085
@thangphamduc4085 3 жыл бұрын
Thanks a lot. It's very good.
@creativearts4917
@creativearts4917 Жыл бұрын
how do we pass this data to main activity means the one from which the location service call ran
@praveshbudhathoki736
@praveshbudhathoki736 4 жыл бұрын
I got error in (Constants.LOCATION_SERVICE_ID), location-service-id is not recognized. help plzz
@ajayvamsee7508
@ajayvamsee7508 3 жыл бұрын
Well superb but why not you provide project repo
@shreyanshjain954
@shreyanshjain954 4 жыл бұрын
sir after using this code the accuracy of location is not fine...this code uses which feature .. GPS provider or Network Provider??...I think gps will have more accuracy
@rakeshpavanmudidana
@rakeshpavanmudidana Жыл бұрын
Sir location share is working in version 13 in background also but that app is not working in any other version like lower then Android 13 version please give me a solution for this sir,🥺
@samseleven1
@samseleven1 4 жыл бұрын
This works great. Thank you so much
@reyzanata8093
@reyzanata8093 4 жыл бұрын
hi how if i want to add marker on Latlng and pass the data in to the components thanks
@DevKumar-ey6fh
@DevKumar-ey6fh 3 жыл бұрын
You got solution? Because I'm facing same problem.
@musicwell3940
@musicwell3940 4 жыл бұрын
Can u please make a tutorial on Google fit Integration
@HarpreetSingh-cl1sp
@HarpreetSingh-cl1sp Жыл бұрын
How i pass the location double value co-ordinate to other activity and set it to text view. PLEASE REPLY
@sandyhuang8322
@sandyhuang8322 3 жыл бұрын
oh man , you save my day and my life , appreciated , thank you ! do you have tutorial about Google Fit?
@TheAftermath
@TheAftermath 3 жыл бұрын
Sorry sir, are Fused Location Provider APIs free to use? Aren't they from Google Play Services? So Are Google Play Services APIs free to use?
@Shivam-kz2dg
@Shivam-kz2dg 2 жыл бұрын
Free
@surenrajp6228
@surenrajp6228 4 жыл бұрын
What android studio you are using bro... it was awesome??
@chiragkachhadiya
@chiragkachhadiya 4 жыл бұрын
It's a theme plugin called material UI.
@AbdulSamad-yu1zn
@AbdulSamad-yu1zn 3 жыл бұрын
Hii Dear all how are you? I hope you all will be fine. I am facing null lat/long issue as i am using fusedlocationproviderclient... If mobile GpS button is enabled then i get location.. if i disable or reEnable it then i get null location.. if if i close or open app again and again Is there any other service or anything instead of this which works fine??
@sandeepkumar-yp6sl
@sandeepkumar-yp6sl 2 жыл бұрын
This code is not working on above API level 28.... please help me sir
@obadaqafisheh9185
@obadaqafisheh9185 4 жыл бұрын
can't get location updates after kill the app!!!
@kamilpuchaa5138
@kamilpuchaa5138 4 жыл бұрын
This may not work correctly when the app work in background. Simply not showing new updates, on the newest Android...
@marceloaguilarsanchez9414
@marceloaguilarsanchez9414 Жыл бұрын
yeah, that's the problem, the code works, but in lower versions of 7, that's a problem that I found in my androrid 11, it doesn't work in foreground :c
@ahmadelmasri9702
@ahmadelmasri9702 2 жыл бұрын
Thanks a lot man !
@barriosraphael4
@barriosraphael4 3 жыл бұрын
Great tutorial!!!! does it work in background?
@syedasadalizaidi55
@syedasadalizaidi55 4 жыл бұрын
Yo bro you saved my life and job lmao
@jayantdhingra4863
@jayantdhingra4863 4 жыл бұрын
Thanku for this tutorial. Also plzz make video on google fit
@musicwell3940
@musicwell3940 4 жыл бұрын
Yes Sir
@zeeshanalimannur5704
@zeeshanalimannur5704 2 жыл бұрын
I'm getting a delay=8000 ms and i don't know what to do I've searched online but couldn't get any help please help me out
@shantanudixit306
@shantanudixit306 3 жыл бұрын
the code is not working in android 11v when app is running in background mode
@pgaurav72
@pgaurav72 4 жыл бұрын
Thank you Sir! The code helped me a lot.
@suryaagungputra298
@suryaagungputra298 4 жыл бұрын
can u tell me what theme u install for ur android stud please ?
@chiragkachhadiya
@chiragkachhadiya 4 жыл бұрын
It's a plugin for android studio called Material Theme UI.
@vsp4
@vsp4 2 жыл бұрын
Thanks
@Kshashir
@Kshashir 11 ай бұрын
Hi...Anyone can help to get the someone mobile location through link or by hidden link?
@apurvadiwe7237
@apurvadiwe7237 Жыл бұрын
Working fine with Android 8,9 But how to get background location above android 10?
@apurvadiwe7237
@apurvadiwe7237 Жыл бұрын
It works fine till 1-2 min after that it stops getting the location.
@syedaamna6086
@syedaamna6086 Жыл бұрын
@@apurvadiwe7237 When I open other applications like facebook or watsapp, it stops giving location updates....
@thanhnguyenminh5723
@thanhnguyenminh5723 4 жыл бұрын
verry nice
@kovgergox
@kovgergox 3 жыл бұрын
Service stops after app is not in focus in my case :(
@HungVu-dm6xc
@HungVu-dm6xc 3 жыл бұрын
how long does the service take to stop in your case? I also encountered the same case. Do you know the cause and how to fix it?
@syedaamna6086
@syedaamna6086 Жыл бұрын
Did u manage to resolve this issue>?
@Blazejek5737
@Blazejek5737 Жыл бұрын
@Joannes25
@Joannes25 2 жыл бұрын
excelente!!!!!
@Mardiyansahok
@Mardiyansahok 4 жыл бұрын
Thank you Sir...but how to add iduser login on the location service?
@zandronarvaza6891
@zandronarvaza6891 4 жыл бұрын
Is it possible to jampack a volley method on the service class ?
@chiragkachhadiya
@chiragkachhadiya 4 жыл бұрын
Yes.
@zandronarvaza6891
@zandronarvaza6891 4 жыл бұрын
@@chiragkachhadiya It crashes the app when I put volley inside. Can you give me a hand please :(
@Shafi10111
@Shafi10111 4 жыл бұрын
how would i call those latitude longitude values in another activity? any help would be appreciated
@anaslakhani
@anaslakhani 4 жыл бұрын
use broadcast reciever
@DevKumar-ey6fh
@DevKumar-ey6fh 3 жыл бұрын
@@anaslakhani hey can you help me how to set text for the value of lat and longt and keep updating it as the value be updated.
@teacup2633
@teacup2633 3 жыл бұрын
Thanks, can you make tutorial to get Country \ City name?
@chchandrasekhar5575
@chchandrasekhar5575 Жыл бұрын
I'm not getting locations when the app is killed
@numanbhati7115
@numanbhati7115 4 жыл бұрын
Sir please make a video on tablayout with only single fragment
@chiragkachhadiya
@chiragkachhadiya 4 жыл бұрын
But if you want only single fragment or screen then what is the meaning of tab layout since tab layout is used when you want to display multiple screens in single activity or something similar to that.
@numanbhati7115
@numanbhati7115 4 жыл бұрын
@@chiragkachhadiya sir you are right make Tablayout logic video
@numanbhati7115
@numanbhati7115 4 жыл бұрын
@@chiragkachhadiya please sir please sir
@chiragkachhadiya
@chiragkachhadiya 4 жыл бұрын
Here it is: kzbin.info/www/bejne/l5u5h52rhLifjJY
@numanbhati7115
@numanbhati7115 4 жыл бұрын
Thank you for your reply sir this video is very helpful for me
@kuteslekkeropzeg
@kuteslekkeropzeg 2 жыл бұрын
Is it possible to download the code ?
@JUANFELIPENIGANEZALIAGA
@JUANFELIPENIGANEZALIAGA 3 жыл бұрын
thanks but how can i add it to a textview please
@hoannguyen9381
@hoannguyen9381 4 жыл бұрын
how to up location continuously to firebase bro????
@warkadang317
@warkadang317 4 жыл бұрын
sir i have issue how to show that lat and long in activity updated
@DevKumar-ey6fh
@DevKumar-ey6fh 3 жыл бұрын
Have you got, because I'm facing same problem.
@kadirbozkurt2412
@kadirbozkurt2412 3 жыл бұрын
How do we send result to MainActivity? Please someone help.
@kushagraahire1871
@kushagraahire1871 2 жыл бұрын
Using intent
@syedaamna6086
@syedaamna6086 Жыл бұрын
broadcast receiver
@Mechas1123
@Mechas1123 4 жыл бұрын
Nice code !!!!
@subhadipbera1456
@subhadipbera1456 3 жыл бұрын
SIR it doesn't work perfectly, plz help me...
@ectechzone4769
@ectechzone4769 4 жыл бұрын
not working above api24 . kindly update what to do
@Shivam-kz2dg
@Shivam-kz2dg 2 жыл бұрын
Include access coarse location , access background location
@maadmayya2550
@maadmayya2550 4 жыл бұрын
Can you make a lap with aws ?
@safatelli4152
@safatelli4152 3 жыл бұрын
how can we make it working in background please ?
@Erwinsmith94040
@Erwinsmith94040 3 жыл бұрын
I appreciate your code but its too complicated for begineers
@my_love_sanatan
@my_love_sanatan 3 жыл бұрын
not working android 10
@ДимаЛузько-с9о
@ДимаЛузько-с9о 3 жыл бұрын
Не хочет показывать координаты
@viralgohil6616
@viralgohil6616 4 жыл бұрын
Thankyou sir But not working not getting latlog
@dimasoktanugraha9573
@dimasoktanugraha9573 4 жыл бұрын
great tutorial sir. i've code your tutorial in kotlin, but when i click button stop location update, in my Log still get location update. is there any wrong?
@reyzareyznata2760
@reyzareyznata2760 4 жыл бұрын
Same as me bro
@chchandrasekhar5575
@chchandrasekhar5575 Жыл бұрын
and background also
@chirujc
@chirujc 4 жыл бұрын
location updates are stopped, when the app is killed from background
@khalilsnoussi8559
@khalilsnoussi8559 4 жыл бұрын
you can't get location updates when the application stops, that's very normal
@chirujc
@chirujc 4 жыл бұрын
@@khalilsnoussi8559 I completely agree with you. But my requirement is getting location updates, even if the app is killed or background
@khalilsnoussi8559
@khalilsnoussi8559 4 жыл бұрын
@@chirujc i understood you, i had similar idea on my current project but in my case i needed notifications to show up even if the application wasnt working in the background and was very disappointed, actually notifications can't popup unless the actual application is working in the background you can test it with facebook or youtube apps.
@chirujc
@chirujc 4 жыл бұрын
@@khalilsnoussi8559 but I believe, there is a way. Working on that, I will update you, once I have working example.
@chirujc
@chirujc 4 жыл бұрын
@@khalilsnoussi8559 you can get location notifications, even if the app is killed from background . Here are the code changes to get it work instead of calling LocationServices.getFusedLocationProviderClient(this).requestLocationUpdates(locationRequest,locationCallback, Looper.getMainLooper()); startForeground(Constant.LOCATION_SERVICE_ID,builder.build()); use LocationServices.getFusedLocationProviderClient(this).requestLocationUpdates(mLocationRequest, getPendingIntent()); and private PendingIntent getPendingIntent() { Intent intent = new Intent(this, LocationUpdatesIntentService.class); intent.setAction(LocationUpdatesIntentService.ACTION_PROCESS_UPDATES); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } In service class @Override protected void onHandleIntent(Intent intent) { if (intent != null) { final String action = intent.getAction(); if (ACTION_PROCESS_UPDATES.equals(action)) { LocationResult result = LocationResult.extractResult(intent); if (result != null && result.getLocations()!=null) { double latitude = result.getLastLocation().getLatitude(); double longitude =result.getLastLocation().getLongitude(); Log.d(TAG,"LOCATION UPDATE: "+latitude+" "+ longitude); // sending data to popup notification, in my case, created static method sendNotification() in Utils class Utils.sendNotification(this, ""+Utils.getLocationLatitude(this)+", "+Utils.getLocationLongitude(this) + ": " + DateFormat.getDateTimeInstance().format(new Date())); } } } } In Utils class, add the following method static void sendNotification(Context context, String notificationDetails) { // Create an explicit content Intent that starts the main Activity. Intent notificationIntent = new Intent(context, MainActivity.class); notificationIntent.putExtra("from_notification", true); // Construct a task stack. TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Add the main Activity to the task stack as the parent. stackBuilder.addParentStack(MainActivity.class); // Push the content Intent onto the stack. stackBuilder.addNextIntent(notificationIntent); // Get a PendingIntent containing the entire back stack. PendingIntent notificationPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); // Get a notification builder that's compatible with platform versions >= 4 NotificationCompat.Builder builder = new NotificationCompat.Builder(context); // Define the notification settings. builder.setSmallIcon(R.mipmap.ic_launcher) // In a real app, you may want to use a library like Volley // to decode the Bitmap. .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher)) .setColor(Color.RED) .setContentTitle("Location update") .setContentText(notificationDetails) .setContentIntent(notificationPendingIntent); // Dismiss notification once the user touches it. builder.setAutoCancel(true); // Get an instance of the Notification manager NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); // Android O requires a Notification Channel. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = context.getString(R.string.app_name); // Create the channel for the notification NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, NotificationManager.IMPORTANCE_HIGH); // Set the Notification Channel for the Notification Manager. mNotificationManager.createNotificationChannel(mChannel); // Channel ID builder.setChannelId(CHANNEL_ID); } // Issue the notification mNotificationManager.notify(0, builder.build()); }
@surenrajp6228
@surenrajp6228 4 жыл бұрын
bro source code ??
@junaciz2409
@junaciz2409 3 жыл бұрын
give me aplication,please
@navinhariharan6097
@navinhariharan6097 3 жыл бұрын
Hey! Could I get the source code?
@SKREFI
@SKREFI 3 жыл бұрын
Source code please?
@ayushikannojia9495
@ayushikannojia9495 3 жыл бұрын
Hey sir thank u for this video... Plz tell me how to save this latítude and longitude on database using postgreaql
@levihuibers5463
@levihuibers5463 3 жыл бұрын
Fucking legend
@НикитаРерих
@НикитаРерих 4 жыл бұрын
Well, nice, but in 2020 Kotlin is the better choice....
@luishectormonterosantos1215
@luishectormonterosantos1215 4 жыл бұрын
Error Android Q+
@VINAYSHARMA2323
@VINAYSHARMA2323 2 жыл бұрын
Source code
@hackaman9752
@hackaman9752 3 жыл бұрын
i need the code bruhhhhhhhhh
@ssanjay3793
@ssanjay3793 5 ай бұрын
source code
@ankeshpandey3630
@ankeshpandey3630 4 жыл бұрын
Check instagram, DM you
@alberto3514
@alberto3514 2 жыл бұрын
if (service.foreground) //Always False NotificationCompat.Builder //Dont show notifications Background, dont work
@bvr9954
@bvr9954 3 жыл бұрын
This works great. Thank you so much
Hilarious FAKE TONGUE Prank by WEDNESDAY😏🖤
0:39
La La Life Shorts
Рет қаралды 44 МЛН
Вопрос Ребром - Джиган
43:52
Gazgolder
Рет қаралды 3,8 МЛН
Android: Request Location Updates in the Foreground
10:34
Mohamed Shehab
Рет қаралды 5 М.
NVIDIA CEO Jensen Huang's Vision for Your Future
1:03:03
Cleo Abram
Рет қаралды 120 М.
Hilarious FAKE TONGUE Prank by WEDNESDAY😏🖤
0:39
La La Life Shorts
Рет қаралды 44 МЛН