Hi Sir...I followed your video.. Thanks a lot for helping.. But I am facing one issue .. My app is showing the live location with the marker on the map in some devices(mobile phones) but it's not showing live loc and map on some phones(it is sending SMS but not showing loc on map).....can you please help me out??
Is there any specific error being thrown? Maps gets updated due to the below line in the code. Will suggest to debug the code and check whether the below line of code is being executed when the Locations is updated. mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); For reference, the complete source code shown in this tutorial is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Hi - thanks for this informative video. Question please. Is it possible to write an android apk that can give you some telephone number's location without them knowing. That is say i have your number X in say India. Can I find your phone's latitude and longitude by using GPS apis and your network operator? Since the operator knows where that phone is located!!
Yes, everything is possible. In simple words it is called hacking. You will have to develop all these functionalities and then run those methods using background process so that the user of the device is not notified of running services. programmerworld.co/android/how-to-create-background-process-in-your-android-app/ programmerworld.co/android/how-to-implement-workmanager-to-run-background-process-iswifienabled-in-your-android-app/
sir im working on a cllg project of this android studio and the video u made would be helpful a bit for me but could this msg send exact location with the msg to the person we want without entering the phone no
Yes, you can send the message without hard-coding the phone number of the recipient. You can access the contact list for the same. Please refer to my below video on how to access contact list: ua-cam.com/video/cgVTbF15YlE/v-deo.html Good Luck Programmer World programmerworld.co -
Yes, this App will send location update every 1 second or 5 meters distance change. You can change these settings by changing the values of variables - MIN_TIME and MIN_DISTANCE - in the Java code. Good Luck Programmer World programmerworld.co -
@@ProgrammerWorld While sending the SMS, if the user checks the Remember my choice checkbox, will all the next sms be sent automatically without asking the user's consent?
Adding the code below: MainActivity.java package com.example.myyoutubelocationapp; import android.Manifest; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.telephony.SmsManager; import androidx.core.app.ActivityCompat; import androidx.fragment.app.FragmentActivity; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private LocationManager locationManager; private LocationListener locationListener; private final long MIN_TIME = 1000; private final long MIN_DIST = 5; private LatLng latLng; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS}, PackageManager.PERMISSION_GRANTED); ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED); ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.INTERNET}, PackageManager.PERMISSION_GRANTED); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Add a marker in Sydney and move the camera LatLng sydney = new LatLng(-34, 151); mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { try { latLng = new LatLng(location.getLatitude(), location.getLongitude()); mMap.addMarker(new MarkerOptions().position(latLng).title("My Position")); mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); String phoneNumber = "99999"; String myLatidude = String.valueOf(location.getAltitude()); String myLongitude = String.valueOf(location.getLongitude()); String message = "Latitude = " + myLatidude + " Longitude = " + myLongitude; SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(phoneNumber,null,message,null,null); } catch (Exception e){ e.printStackTrace(); } } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } }; locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); try { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME,MIN_DIST,locationListener); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,MIN_TIME,MIN_DIST,locationListener); } catch (SecurityException e){ e.printStackTrace(); } } }
There might be some APIs deprecated now in newer version of Android. You may have to take care of them. If required, you can also refer to the complete source code for this tutorial from below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Good Luck Programmer World programmerworld.co -
@@ProgrammerWorld Sir, the onStatusChanged() method has been deprecated. Writing @Deprecated instead of @Override on onStatusChanged() method removes that error. But the app is not starting.
@@RockStar-ll8qp Place a try - catch in onCreate method and try to read the exception which is being thrown. That may give a hint on possible issues with your App startup. Good Luck Programmer World programmerworld.co -
@@ProgrammerWorld Still not working. I have written the exact code you have written. Changed the @Override to @Deprecated for onStatusChanged(). The Build Output is showing no error. Just the emulator says TestApp14 (the name of this app) keeps stopping. I have used try - catch as advised by you. But still the same result.
Hi, sir, thank you for your good explanation, its very good. But how can i do this but with using mapbox? Google maps is not free for me to use plus we need to put the billing info first, so i just used mapbox. Can you please teach me how to do this tracking things with mapbox and the sms notifications too? You can just email me if you want or reply to me here. Thank you so much.
I live coded along with your video and the app worked fine with few issues: 1) Numerous number of markers appeared on my map screen. 2) The app kept on sending text messages (over 7 messages before I could turn OFF the internet connection). 3) As shown in the video, it did NOT prompt any permission requests. When I attempted to code that part, it asked for API greater than 23. I'm running the app on my phone which is android version 5.1 (API 22). My question is: a) How do I fix Problem 1? (i.e., the marker should point to the accurate location). By the code it seemed for every 1 second/5m change, the location gets updated? So, I'm assuming, the marker should only be drawn on latest location? How is that possible? b) Is there a way to code such that even lower APIs will ask for permission? c) Do you have any resources on how to send notification (e.g: position coordinates) to the other users of the app (from within the app)?
Find the response in-lined below: a) How do I fix Problem 1? (i.e., the marker should point to the accurate location). By the code it seemed for every 1 second/5m change, the location gets updated? So, I'm assuming, the marker should only be drawn on latest location? How is that possible? Just use mMap.clear command before the AddMarker command. The clear command will ensure all the existing markers are deleted from the Map before adding the latest one. b) Is there a way to code such that even lower APIs will ask for permission? The App should prompt for the location permission. Location permission can't be acquired implicitly by the App (due to privacy policies) unlike some of the other permissions (like access to the Internet). Having said that, the App will ask/ prompt for the permission only for the first time after installation. Once permission granted it will not ask again. Uninstall and install a fresh App. It will prompt for the permission from the user. Otherwise go and check the permissions in the Settings. The location permission shouldn't be available for the App. c) Do you have any resources on how to send notification (e.g: position coordinates) to the other users of the app (from within the app)? For sending the in-App notification you need to set up the Push notification mechanism. For that you will need a server which can push the notification over the internet. In this video the focus has been to make it work offline (no internet needed). I hope above helps you. Good Luck Programmer World programmerworld.co -
@@ProgrammerWorld thank you for responding quickly. I understand when you say app shouldn't be given permission. But by default it didn't ask for any permission as shown in the video. Might be something related to my version [5.1 api 22]? When I checked the settings it was given whole network access and sms app permission [which will cost]. I don't know how though. This works without internet? 😯😯 does that have anything to do with coarse location?
@@ProgrammerWorld have you posted any tutorials on using server with android studio? Couple of people suggested to use firebase for the push notification that you mentioned. Thank you again!
Network permission is fine. But location and SMS permission is not possible to be granted without explicitly asking it from the user. Anyway, as suggested in previous comment as well, uninstall and reinstall the App. It should ask the permission. Yes, this works without internet. You are right. It takes the coarse location information using the GPS data of the phone. Cheers Programmer World programmerworld.co -
Hello sir, I'm currently working on GPS Tracking App, I've followed your steps but I want to make it counts/tracks how much Kilometers I have travelled, I don't know the code to make it, Would you mind giving me the answer? Thank you, Have a great day sir.
I think that is what is shown in this video. You can hardcode the mobile number to which the SMS should be send automatically. You can also configure/ set the time interval of such SMS updates to be sent. Further, you can watch below video which shows steps to store the location coordinates on Firebase database on a regular basis: ua-cam.com/video/hyi4dLyPtpI/v-deo.html Cheers Programmer World programmerworld.co -
Hello, i just finished the project and its work thank you so much but why he does not show me the exact location! and can i add something else in the sms?
The App should show you the exact location. However, if you are running your App on emulator then it will show initial location at Sydney because that is the starting marker position we have set in the code. And later it will move the marker position to California because emulator is not able to give you the location info as it doesn't have GPS or network data. So, it moves to some Pre-defined location in emulator. However, if you try running it on your real phone, then it should definitely work. For the first time you may have to go in some open space to get nice view of GPS satellites. Regarding SMS, yes of course you can send more information. While composing your SMS string "message" feel free to add your additional texts.
Okay thank you for helping but he doesn’t give me access to choose the phone. automatic execution with emulator and for the sms can i a text with the name of the location ??
Oh ... ok. To run your application on your phone, you will have to build the APK (Android Package) file. Then install the App on your phone using this APK file. Then your App will be ready for use on your phone in standalone mode. For steps to create a APK file please watch my below video: ua-cam.com/video/5c7odVDNHj0/v-deo.html For steps to install the App please watch my below video: ua-cam.com/video/StswYn4GSzk/v-deo.html Hope above helps. Good Luck!
Regarding the name of the location, I am not sure how to get the name of the city from the latitude and longitude information. As long as you are able to retrieve that information, you can edit your message string to add the name of location in your sms.
Hey, I wanted to ask that, in this video Latitude and Longitude is sent via SMS but how can we send a proper link through which receiver can click and get the location in Google maps? I mean link for current location just like we use to send in whatsapp? please help me I am stuck. Thank you
You can send it in the form of below link: maps.google.com/?q=, The details are given on my below webpage: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Also, it is mentioned in one of the previous comments. Cheers Programmer World programmerworld.co -
Hey, I'm working on a project that requires a similar feature. I have a little issue: When I send a sms, my latitude and longitude display as 0. Could you tell me how I can fix this?
That's because the location is not getting updated in your App. There could be multiple reasons for this. Request you to please check the below page for source code: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Also, below page can be referred for an alternative method to fetch the location coordinates: programmerworld.co/android/how-to-get-the-device-last-location-using-gps-network-without-using-map-layout-in-your-android-app/ Hope above helps. Cheers Programmer World programmerworld.co -
You can use below API to get the location without using MapsActivity: fusedLocationClient = LocationServices.getFusedLocationProviderClient(this); fusedLocationClient.getLastLocation().addOnSuccessListener(); Good Luck Programmer World programmerworld.co -
Sending WhatsApp messages cannot be completely automated by the intent as WA does not allows it. However, at least the text can be copied in the respective chat. Please refer to the below: programmerworld.co/android/how-to-share-file-or-text-on-gmail-whatsapp-sms-bluetooth-from-your-android-app-share-button/ programmerworld.co/android/how-to-open-start-another-app-such-as-gmail-whatsapp-sms-facebook-from-your-custom-android-app/ For reference, the complete source code shown in this tutorial is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Hello Sir! We are trying to make a tracking system app that can be use in an off-grid places, Can you give us some advice on how we could track other devices and send them a message or a notification with no signal at all? We are planning to use Wifi triangulation method? Is it possible? Can you help us? Thank you!!
Better than Wi-Fi triangulation, why don't you try to use Bluetooth method to connect to the nearby devices. This method is very much used for location tracking in indoor setups, no-network or even congested network setup. Using the Bluetooth one can also transfer the messages even when there is no network available. The only caveat of this approach is that you will need a network of closely placed phones which are ready to share their Bluetooth network with your App. This is tough to implement but possible. Regarding Wi-Fi triangulation, one advantage will be that there are ample of solutions available over internet. So, you can try them as well. Good Luck Programmer World programmerworld.co -
Below tutorial shows how to get the address of the current position: programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/ Probably, using this concept it will be possible to build a database of nearby places/ point of interest (such as restaurant, hospital, etc.) and show them on the Map. Cheers Programmer World programmerworld.co/ -
sir my project is about track vehicle using gps tracker device. can i just follow this tutorial? but did you know how to integrate the gps tracker device?
Yes, you can use this tutorial to design your tracker application. You can also watch my below video on tracking if you want to store the location information in some database like Firebase (of course internet access will be required to access database servers): ua-cam.com/video/hyi4dLyPtpI/v-deo.html Regarding integration, every GPS tracker device has different settings. So, it depends the GPS device you are using. Best will be to go through it's manual. I hope above helps. Cheers Programmer World programmerworld.co -
Yes, the map will automatically refresh on the change of the location. But this cannot be tested on an emulator because the sensors (location sensors such as GPS) are not available in emulator. So, to test this please use a real phone/ device. Cheers Programmer World programmerworld.co -
This is also Java language. It is written in Android Studio IDE for Android App. For reference, complete source code and details shown in this video is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Hey There, i have implemented as like you in my app, but in coordinates the latitude points to 0.0,Is that a correct one or do i need to change anything else??
No, that's not correct. Latitude and longitude should show your actual location coordinates. Only if you are exactly at equator, your latitude will show up 0. But that is very rare. So, my guess is that your App is not getting location access permission in your phone. I will suggest you recheck your code. If possible refer to my code shown from below webpage: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code I hope it helps. Cheers Programmer World programmerworld.co -
@@ProgrammerWorld There is a small mistake in your code, in there exactly you have gave a method to find the altitude() but while changing to string and calling the you have gave it as latitude, this gives a confusion to the method that why the altitude is 0.0
Oh, yes I remember this. Initially while creating this video by mistake I used Altitude instead of Latitude. I corrected that in the later part of my video. Sorry for any confusion. I hope other people don't get confused with this. Anyway thanks for pointing this out. Good Luck Programmer World programmerworld.co -
@@imuksd This functionality is in my list. I will soon present a tutorial on this topic to switch GPS on and off programmatically from your Android App. Cheers Programmer World programmerworld.co -
If maps layout is not needed then below page can be referred to get the location coordinates in your App: programmerworld.co/android/how-to-get-the-device-last-location-using-gps-network-without-using-map-layout-in-your-android-app/ Cheers Programmer World programmerworld.co -
Refer to below tutorial to run an App in background: ua-cam.com/video/tFGlLa2fwNQ/v-deo.html Or below videos for foreground running of the App: ua-cam.com/video/MRm6NgZlmDc/v-deo.html ua-cam.com/video/xxC4-BLNSSc/v-deo.html Good Luck Programmer World programmerworld.co -
Hello, I am doing a similar tracking app but I need to keep the app working in the background and continue receiving the data if the user leaves the app or blocks the cell phone. Could you give me some advice on how to do that? Or do you have a video where you explain it?
You can watch my below videos to run an App in background. This video explains how to run an App in background as foreground services: ua-cam.com/video/MRm6NgZlmDc/v-deo.html This video is another example which shows how to use broadcast and notification in foreground service: ua-cam.com/video/xxC4-BLNSSc/v-deo.html Hope above helps. Good Luck Programmer World programmerworld.co -
Hi sir, how about track location of object for example vehicle using gps neo-6m? is this the same way to exchange location data? Pleasee notice me sirr
Yes, concept remain same. The only challenge will be to get the data from device or chip (like neo-6m GPS) and send it to over SMS or through server (Firebase database). You may have to check how to get the data from the chip to your Android App. For steps on exchanging the data over the Firebase database one can refer to the below link: programmerworld.co/android/create-location-tracking-android-app-by-exchanging-location-information-over-firebase-database/ Cheers Programmer World programmerworld.co/ -
Hi sir, may i ask why i followed your source code and successfully run, the google map running on virtual device doesnt show map, only blank white screen ya
Sometimes it may take time for the map to get downloaded and set in your App's map layout. So, give it some time to get the map loaded. For reference, the complete source code shown in this tutorial is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Hello sir I need your help for my project My project is about women safety app and just by clicking on emergency button it should send location to the all three contacts that are save
@@gerlynm50 im still doing code but i only got one two parts that ive been working on. Give me your email and ill contacy you over there to see how i can help as for my part.
Sir, here in this app, sms is being sent to only one number (i.e which is defined in the coding) but how to take the number as input during runtime. I tried by adding another activity(main) where the user will enter a phone number where the sms is to be sent and finally he will click the submit button and then the MAP will be loaded and SMS will be sent to the entered phone number. But in my app as soon as the submit button is being clicked, the app is being closed. Can you say sir, what can be done ?
It is pretty simple. Just insert an EditText in the layout and take the input from the user. Read the content of EditText in the Java code and use that number to send the SMS. For example on how to insert widgets in the maps layout, below tutorial can be referred: programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/ Hope above helps. Good Luck Programmer World programmerworld.co -
sir im from philippines can you help about my project name of Skylab app tracking the user open his location and the admin passenger will notify where is he using sms?
I think how to send or update one's location through SMS is shown in this video. So, this concept can be used to implement the project for tracking users. If any specific query is there then please let us know. Cheers Programmer World programmerworld.co -
Sir I want to develop an app such that if we shake our mobile location will be sms Ed to the registered number and even call is placed . Can u make a video on this
I think it should be possible. Just send the location info in the gmap url format over any communication channel. For sending message over whatsapp, the below link may help: ua-cam.com/video/XvH748sImco/v-deo.html Cheers Programmer World programmerworld.co -
I want to know this for apikey generation whether we need to billing acount in google cloud platform because it giving billing need to enable responce when i use this api key for reverse geocoding api request and getting location address...at first tested in postman it gives me that error responce (billing account to be enabled)....Is this is payable one? Can anyone please clear me out on this
AFAIK for small scale (non-commercial) purpose google provide this API Key for free. You will be charged only for high usage. As shown in my videos, the steps are for getting the API Key for free. You can refer to my other videos also on this topic. Links posted below: ua-cam.com/video/hyi4dLyPtpI/v-deo.html ua-cam.com/video/rN7x3ovWepM/v-deo.html Hope it helps. Good Luck Programmer World programmerworld.co -
Hi Ken, That's exactly what is shown in this video. Here, in this tutorial it creates an App which sends the updated location info (latitude and longitude) to a pre defined number through sms. In conjunction to this video you should watch the next part using the below link where it shows how to convert latitude and longitude information to an actual address: ua-cam.com/video/Nsl99WWDFxM/v-deo.html
@@niamhmcnulty1774 Yes, normal sms charges will apply for each message sent. I have unlimited free message plan, so it's practically free for me. 🙂 Cheers Programmer World programmerworld.co -
No, not necessary. The contact number of the recipient need not be saved in the code. You can access the contact for the same. Please refer to my below video on how to access contact list: ua-cam.com/video/cgVTbF15YlE/v-deo.html Good Luck Programmer World programmerworld.co -
In the code shown in this video, the location will automatically be sent whenever there is an update in location information. This is taken care in the onMapReady method. In this example it does not show any manual triggers, such as buttons, etc. Location will be updated based on any of the conditions (MIN_TIME,MIN_DIST) defined int he code is triggered. If you need to implement a manual trigger/ button click in the maps layout then one such example is shown in the below page: programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/ Hope it helps. For reference, the complete details and source code shown in this video is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Sir, I am running this code, but only one permission is working.. If I write send_sms first , then location is not working but if I write location permission first, then sms service is not working.. What to do? Also, for how long will it keep tracking?
Sir, I am running this code, but only one permission is working.. If I write send_sms first , then location is not working but if I write location permission first, then sms service is not working.. What to do? - Ideally it should work. I assume you have made the declaration in the Manifest file also. However, if it is really giving issue then try below approaches: 1. Split the permission method to individual permissions. Something like below: ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS}, PackageManager.PERMISSION_GRANTED); ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED); 2. If it still gives issue then use an IF condition to check for the permission, something like below: ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS}, PackageManager.PERMISSION_GRANTED); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED); } Also, for how long will it keep tracking? - It will keep tracking as long as the App is active. So, there is no time limit to it. It is similar to any map based App (like google maps or Uber). For reference, the complete source code shown in this tutorial is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Then form the google map URL string and send the string in the message (SMS). I think the format of the URL is: maps.google.com/?q=, Below is the example URL for - Latitude = 41.24 Longitude = 2.06 maps.google.com/?q=41.24,2.06 A bit processing may be required to get the string in above format. Good Luck Programmer World programmerworld.co -
@@ProgrammerWorld okay thanks sir, one last question.... i'm getting ERROR like this: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:17.0.0.
Sir, I am facing a problem, actually the app is working and sending sms also but the MAP is not loading. Previously it was working well i.e MAP was also loading and sms were being sent as well but thereafter I uninstalled it and made some changes and since then MAP is not loading. Thereafter again I wrote fresh code (ditto what you have shown) although the app is sending sms but MAP is not loading. What is the problem sir. My phone is Redmi note 8 pro. All permissions are already given including location (manually from settings).
Sorry, but it should have worked after re-installation. Few things which I can suggest: 1. Try uninstalling the complete App along with the App data deletion and then go for a fresh installation. 2. Also, in the new APK file, increase the version of the App (by changing the version in the gradle file). Increase it from 1.0 to say 2.0 and then try to install the new APK file. In this Android will take it as an advanced version of the same App and would handle the App data/ permissions better. Good Luck Programmer World programmerworld.co -
@@ProgrammerWorld Thank You Sir for your reply. Now I understood what was the problem there. Actually I was copying same Google MAP api for different projects. I copied the url and generated a brand new api and then Bingo... It worked. Keep going sir. Big fan of yours. 🙏
Sir, here in this app, sms is being sent to only one number (i.e which is defined in the coding) but how to take the number as input during runtime. I tried by adding another activity(main) where the user will enter a phone number where the sms is to be sent and finally he will click the submit button and then the MAP will be loaded and SMS will be sent to the entered phone number. But in my app as soon as the submit button is being clicked, the app is being closed. Can you say sir, what can be done ?
Of course there are many ways. One of the other way (through Firebase database) is presented in the below link: programmerworld.co/android/create-location-tracking-android-app-by-exchanging-location-information-over-firebase-database/ Hope it helps. Cheers Programmer World programmerworld.co -
sir, please help me for my project. if the bus driver (bus) is at a particular distance from the user then user should receive a notification regarding the bus. how to code for this.
Just get the coordinates of both the phones using GPS. Then compute the distance between the two and if this distance is less than the threshold then raise the notification. You can transfer the coordinates (latitude and longitude) of drivers phone to user's phone through sms as shown in this video.
Watch my below video which gives steps on how to convert latitude and longitude to an actual address using Google map's Geocoder API: ua-cam.com/video/Nsl99WWDFxM/v-deo.html Good Luck Programmer World programmerworld.co
@@ProgrammerWorld the above video is helpfull in converting the longitude and latitude but how can we send the location info with that of the longitude and latitude through sms on our desired number ?
@@sahilbhat8273 You can use the same concept shown in this current video (track your location using GPS and send it over sms). The only thing is you have to modify is the message string to include the location details along with latitude and longitude. You should change below line in my source code to include the output from the Geocoder: String message = “Latitude = ” + myLatidude + ” Longitude = ” + myLongitude; The complete source code of this tutorial is shared at: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ I hope the above helps. Good Luck Programmer World programmerworld.co -
We can use Geocorder API to translate the latitude and longitude to the address. We can get the address using the below command: geocoder.getFromLocation(latitude, longitude, 1) Alternately, you can also use below command to show the location on map: mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); I will try to create a tutorial for Geocorder command and let you know once posted.
You should see my next video from the below link. It shows the steps to get the location details from latitude and longitude : ua-cam.com/video/Nsl99WWDFxM/v-deo.html
Hello Sir, I have followed the whole video but I still faced one problem that when I turn on location service, the activity will crash. May I know the reason?
Try to debug and check for the reason of crash. Most likely the onCreate method is crashing. Better put a try-catch for smooth handling. Also, crashes during the start is most of the times due to null pointer exceptions. Please debug and check. For reference, the complete source code shown in this tutorial is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Refer to my below pages. It may help: programmerworld.co/android/how-to-open-and-send-email-using-the-native-client-directly-from-your-android-app-source-code/ programmerworld.co/android/how-to-send-email-using-gmail-smtp-server-directly-from-your-android-app/ Cheers Programmer World programmerworld.co -
Sir the requestLocationUpdate functions at 20:45 in the video in try block are giving out an error "missing permissions required by location manager". How to fix it?
I think you have missed getting location permission from App's user in the Java code. Add below line in your code as shown in the source code shared in the following link: ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED); programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
still getting this error W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6898) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found. I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4 Selected remote version of com.google.android.gms.googlecertificates, version >= 4 I/DynamiteLoaderV2: [71] Googlecertificates W/xample.locatio: Unsupported class loader W/xample.locatio: Skipping duplicate class check due to unsupported classloader E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@a5470ce[MapsActivity] E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
@@antrashrey6049 It will be difficult to analyze the issue using only the given error message. Complete source code will be required to evaluate it. Good Luck Programmer World programmerworld.co -
Hello Sir I have just finished the project and the sms is not working if i run it in the Android Studio emulator. I mean I get no sms. Please could you tell me what to be done here?
In emulator the mobile service is not available. So, I don't think it can send SMS to a real telephone network. Emulator should be used to only test the concept. Cheers Programmer World programmerworld.co -
Programmer World sir thank you so much! I think this app will work offline without internet connection. And how will I follow the exact coordinates send as sms in real google map? And what about the phone number we give in the codes, am I suppose to change it to my exact mobile phone Number with the country code or I should keep the “99999” provided in the code? Please I hope you will help me I just want to know this!
Then please check if all the required permission, like access to location, is granted to the App. You can go to the App permissions in the setting of your phone to check this. Cheers Programmer World programmerworld.co -
That's exactly is shown in my below video (location tracking by exchanging location over Firebase database): ua-cam.com/video/hyi4dLyPtpI/v-deo.html Good Luck Programmer World programmerworld.co -
Please refer to my below video on getting the battery level: ua-cam.com/video/KAKn6XdMaxM/v-deo.html Combine these two tutorials to complete your requirement. Good Luck Programmer World programmerworld.co -
For sending a file, below link might help: programmerworld.co/android/how-to-share-file-or-text-on-gmail-whatsapp-sms-bluetooth-from-your-android-app-share-button/ For recording the audio, some reference is available in below link: programmerworld.co/android/record-and-play-the-sound-simultaneously-live-stream-over-bluetooth-speaker-in-your-android-app/ Cheers Programmer World programmerworld.co -
Could you please let us know what do you mean by GPS module? Do you mean any device which supports GPS like Car navigation? If yes, then if the device supports Android OS then you can develop the App using the steps shown in this video. If you mean, any other App on your Android phone then that App should explicitly enable this feature of GPS tracking. Cheers Programmer World programmerworld.co -
For any App, there is only one main code/ class (MainActivity). So, a simple copy paste of this code into your existing code file would not work. You will have to integrate this as a separate class in your existing project and call it wherever required. For reference, the complete source code shown in this video is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
This is exactly what this video shows. One can refer to the source code of this video at the below page: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Also, the other approach to exchange data (of location) could be to use some kind of database, such as Firebase database example as shown in the below link: programmerworld.co/android/create-location-tracking-android-app-by-exchanging-location-information-over-firebase-database/ Cheers Programmer World programmerworld.co -
Hello sir, can we modify the code so that the process is reversed? I want to define a secret code message in my code. And if someone texts me that exact code message, then my app will send the gps co-ordinates to that number automatically.
Yes, of course it is possible. For that you will have to read all the incoming SMSes in your App and when you receive your predefined key word you invoke the location send method which will send the location to the number either hard coded or to the number received in SMS. For steps on how to receive and read the SMSes, please watch my below video: ua-cam.com/video/K9IloJ_66WI/v-deo.html The complete source code is also shared at below link: programmerworld.co/android/how-to-access-sms-or-read-last-sms-in-your-phone-using-your-app-android-studio-java-code/ Good luck Programmer World! programmerworld.co/ -
Sir, the SMS feature works on the emulator, but when I run the APK in my Honor 7A phone...sms is not sent and the below error is shown. E/BufferQueueProducer: [] Can not get hwsched service please help me.
Thanks for bringing this up. Yes, there are issues in running google services on Huawei phones due to restriction from US government. Huawei cannot use certain services such as Google play store. In this App, to access the location and map, one needs the access to the services from Google play store. So, the issue you are reporting is probably due to such restriction. I will check if there can be any workaround for the same and let you know. PS: To overcome such restrictive challenges, Huawei is coming up with its own OS named HarmonyOS (Hongmeng in China). This may be the OS in their future phones. Hope the above details helps. Good Luck Programmer World programmerworld.co -
Thanks for the suggestion. I will definitely make a video (when time permits) to show the steps to send the location to a website. Cheers Programmer World programmerworld.co -
I think you can use any database to store or record the information. Below video shows how to do it using the Firebase database: ua-cam.com/video/hyi4dLyPtpI/v-deo.html Good Luck Programmer World programmerworld.co -
hello sir i am making my final year project on alcohol detection and it detects the alcohol percentage as driver breathe in the car. So i want to make an application that send the driver (who has drunk) current gps location to the police station, so does this above code will be satisfy the outcome of our project.
Yes, following the concept shown in this video will help you to implement your project as described. Based on the input from breath analyzer, the location data can be sent over SMS to the nearest police station. Also, if you want to store all such information in some kind of database then you can watch my video at the below link: ua-cam.com/video/hyi4dLyPtpI/v-deo.html Having database will help to do some analytics over the data which will be received over a period of time. Also, using database, the information can be accessed from various platforms simultaneously. Candid confession - more than the technicalities behind this application, I really appreciate your idea of helping the society at large by avoiding/discouraging drunk driving on road. Cheers guys .... Keep it up. Good Luck Programmer World programmerworld.co -
Sir,the app is not getting installed in my phone. In honor 6x it is showing "The package is corrupted" and in Mi phone it is showing "App is not installed"
Is it running successfully on emulator? Just for information, the complete source code shown in this video is shared at the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
@@alekhyaparimala5200 Yes California location is fine in Emulator. That is expected. For your real phone, check if the minimum SDK of your phone (Android version) supports the min SDK of your App. You can check that in the gradle file of your project. If the above is correct, then please try once again by re-building and re-installing the APK file. Good Luck Programmer World programmerworld.co -
For the SMS issue, I will suggest first try to create only an SMS App and see if it works. Then you can combine the SMS App with the Location App. The complete code for the SMS App can be found in the below link: programmerworld.co/android/how-to-send-sms-automatically-from-your-phone-by-programming-in-android-studio-java-code/ For your 2nd question, you can clear the markers before adding a new marker to the map. In this way you will only have one Marker at a time on the Map.
Check if SMS permissions are granted to this App. If yes, then debug your code and check if the below line of code if hit or not while debugging: SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(phoneNumber,null,message,null,null); The above code lines are from the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
@@ProgrammerWorld thanks sir i solve the issue but now im facing another problem. How can i put a button to invoke the google map activity but without going to the interface of the google map? And how can i stop the function from the same button
No, internet will not be required. Location information will be received through the GPS and the information will be transmitted using the SMS. So, no internet will be mandatory for the operation of this App. Good Luck Programmer World programmerworld.co -
Can you please share the error text you are getting? Also, can you please let us know what you mean by sync now option. AFAIK, the location info will be send automatically over sms on regular interval. Cheers Programmer World programmerworld.co -
Yes, it should be possible. Just install this App in the phone to be tracked and give all the required permission. Then you can automate the SMS reading using the code shown in below link. programmerworld.co/android/how-to-access-sms-or-read-last-sms-in-your-phone-using-your-app-android-studio-java-code/ So, based on the certain key-words in the read SMS (Say "Location") then send the location to the required phone number through SMS using the concept shown in this tutorial. Hope the above helps. Cheers Programmer World programmerworld.co -
Simply adjust the below variables in your code: private final long MIN_TIME = 1000; // Every 1 second the SMS will be sent private final long MIN_DIST = 5; //At a change of every 5 meters will be sent If you want the message to be sent more seldom then increase these two values. Say: private final long MIN_TIME = 1000000; // 1000 seconds (16.66 mins) private final long MIN_DIST = 500; // 500 meters In above, the message will be sent either every 1000 seconds or on a change of 500 meters whichever is earlier. For complete source code shown in this video, one can refer to the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Just insert an editText in the layout and take the number entered by the user in the editText to send SMS. Hope above helps. Cheers Programmer World programmerworld.co -
No, when mobile is switched off then it will not work. However, even if you move away from this App to work on another App with mobile switched ON, this App will continue to work in background and will send updated location info SMS regularly. Good Luck Programmer World programmerworld.co -
You are trying in emulator or actual phone? Check if you have given all the permissions to the App like reading and sending SMSes. In worst case I will suggest to debug the code and see if any exception is thrown.
Convert your string in the below format: maps.google.com/?q=, Below is the example URL for - Latitude = 41.24 Longitude = 2.06 maps.google.com/?q=41.24,2.06 A bit processing may be required to get the strings in above format. Good Luck Programmer World programmerworld.co -
Getting the location of other mobile by SMS would be possible if and only if that mobile has granted access to its location. If the required permission is granted then a custom application can be created which reads the SMSes. When it receives the specific SMS then it fetches the location and sends the coordinates back through SMS. This workflow is possible and I will try to make a tutorial on this and let you know once I post it.
@@ProgrammerWorld sir I had made an application that does exactly that but google rejected it stating that app must be default sms handler .since it uses receive sms permission .I got the permission declaration form and didn't know that to do.
@@OmarAhmed-jo1cf The complete source of this project is shared at the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ I will suggest you to once verify your code including the Manifest file and compare it with that shared by me. If still you are getting the issue then I will suggest you to post your complete code and I will have a look at it. Cheers!
No, this App works in offline mode. Not needed to connect to Firebase database. You can refer to the below video for Firebase concept: ua-cam.com/video/hyi4dLyPtpI/v-deo.html Cheers Programmer World programmerworld.co -
To which website the data needs to be sent? If you have the access to the database of the website, then you can of course configure your App to directly write to the db. However, can you please clarify how do you want to access the website?
Sir, here in this app, sms is being sent to only one number which is define in the code. How can i create a list of predefined contact and the sms will only send to these stored numbers without having to insert the phone numbers again
Simple, just repeat the below line in your code for each number to which the SMS should be sent: smsManager.sendTextMessage(phoneNumber,null,message,null,null); To create a list of pre-determined phone numbers, just use a Macro and repeat the above line in the code for each number in the macro. For reference, complete source code shown in this tutorial is shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
@@ProgrammerWorld Sir, I have tried but it is not sending the sms when screen is locked. I have combined Geocoder with this program. Is this happening due to Geocoder?
@@RockStar-ll8qp I doubt that it is happening due to GeoCoder API. I will have to check on this and then will confirm it. Cheers Programmer World programmerworld.co -
Convert the string in the below format: maps.google.com/?q=, Below is the example URL for - Latitude = 41.24 Longitude = 2.06 maps.google.com/?q=41.24,2.06 A bit processing may be required to get the strings in above format. Cheers Programmer World programmerworld.co -
Once you start the App, it will remain active in background even if you have switched to another app or your home screen. To stop it you will have to explicitly kill it through task manager of your phone. Regarding the frequency of message, right now in my code I have used MIN_TIME = 1000 ms. You can increase it to your requirement. Otherwise with current setting, it will send the sms every 1000 millisecond (1 second). I hope above explanation helps. Good Luck Programmer World programmerworld.co -
@@ProgrammerWorld i force stop it but it still sending message is it possible to remove the MIN_TIME cause i just want to send the message only one time.
@@MakeSenceHindi Once the App is force stopped or killed, then that process is not running and hence it should not send SMS. I am not sure how a task is being executed when the process itself doesn't exists as it is killed. Please check or kill all the Apps in Task manager and review. It should NOT send messages once the process is killed. Regarding MIN_TIME parameter, I don't think it is possible to avoid it. It is mandatory argument in the requestLocationUodate API. Though, to solve your issue you can give it a very large value practically making it infinite and hence will never reoccur. Good Luck Programmer World programmerworld.co -
Hi Lalitha, As far as I understand, the code shown in this tutorial does the job of sending the SMS automatically whenever there is a location change and "onLocationChanged" method is called. Please refer to my complete source code shared at the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ However, if you want a manual control of sending the SMS, then you can simply put a button in your layout and in the onClick method of that button you can implement the send SMS code. Something similar is shown in below code (albeit for getting the location details and not sending SMS): programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/ Hope above explanation helps. Cheers Programmer World programmerworld.co -
Once the location is obtained using the concept shown in this video, one can use below concept to send it via whatsapp (or any other app such as gmail): programmerworld.co/android/how-to-share-file-or-text-on-gmail-whatsapp-sms-bluetooth-from-your-android-app-share-button/ For reference, the complete details and source code shown in this video is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Is this issue for SMS permission or location permission? In the Google map activity, it may be taking the location permission implicitly. Also, if you have granted the permission once then on restarting the App or reinstalling the App it may not ask for the permission again.
@@ProgrammerWorld Thankyou Sir For your quick responce! Sir Iam getting the location and it keeps updating but its not Sending the message of location!
@@cslearners9947 Then check your SMS permission. Either you have missed to define that in the manifest file or missed getting the permission from the user in your java code. If you still have issues then send your code or refer to the below webpage for complete source code: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ -
@@ProgrammerWorld Thankyou Sir! My problem is solved!But i have a question That ow does these longitude and latitude will take me to the location?on google map..
@@ProgrammerWorld And Again i appreciate your work! And in request to plz make the video on Sending messages to numbers from FireBase! Thankyou In Advance :)
I think you are referring to the right video. Here, it is explained how to send SMS to pre-set emergency phone numbers along with your location details. Good Luck Programmer World programmerworld.co -
@@MeeraMoments Create a class with Map Activity. Make sure you have defined this Map activity in your Manifest file. Then start this Map Activity from another activity using StartActivity method. This is a bit tricky but the steps are simple. (I don't have a tutorial o this right now). Good Luck Programmer World programmerworld.co -
This code works for most of us. Are you getting any specific error or issue? Have you given permission for access to location both in Manifest file and java file? Please check these in your project. Cheers Programmer World programmerworld.co -
@@ProgrammerWorld i received my current position N thn again n run the program then i am not, getting the current position. No error activity is running but output is not cuming I gave permission as well And i did sms wala code as well but i. M not receiving any msg I gave permission for this as well
If it has worked once then it should work again. Your App code is correct. I will suggest, try to go in open where you have clear access to GPS satellite. This will ensure that your App gets your location info. Regarding SMS, please check the mobile number is correctly coded in the App's code. I will repeat that if the SMS has worked once then it will work again. Good Luck Programmer World programmerworld.co -
Better to directly put the number in the code or take the number from user as an input from the layout. However, if you still want to interact with Firebase database, you can refer to my below video: ua-cam.com/video/hyi4dLyPtpI/v-deo.html Good Luck Programmer World programmerworld.co -
You will need to install this App on their phone with your phone number to receive the SMS. Bingo! Then you can track their whereabouts. For reference, the complete source code shown in this tutorial is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Complete Source Code is available at below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
Just curious to know, any specific reason behind this comment? I think we should see this as a platform to exchange knowledge rather than just a forum to seek help. Cheers Programmer World programmerworld.co -
@@ProgrammerWorld sorry I've been looking at several coding tutorials today and the comment sections are littered with people begging for help in bad grammar. Its irritating because its not the video posters job to help hundreds of inept students with their projects. They need to help themselves or at least speak in complete sentences.
@@rhetorical_annihilation Yes, I agree with you. These videos should be seen as a platform to exchange ideas and knowledge and not just an easy way to get your school project done. Thanks for your inputs. Cheers Programmer World programmerworld.co -
Sir i am student i am working on some project similar to this i need your help I'll contact you with your mail can you please check and respond accordingly hope you will help me out and i need your help very badly
Can you please elaborate your requirement and we can point to the right video or webpage for that implementation. For reference, details shown in this video is also shared in the below link: programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/ Cheers Programmer World programmerworld.co -
@@ProgrammerWorld sir i need auto reply message to send the coordinates to the particular friend. For example I need my phone gps coordinates And i lost it somewhere So i will send an sms to my phone from my friend phone to "send me the coordinates" it should send me back the coordinates dynamically
Hi Sir...I followed your video.. Thanks a lot for helping.. But I am facing one issue .. My app is showing the live location with the marker on the map in some devices(mobile phones) but it's not showing live loc and map on some phones(it is sending SMS but not showing loc on map).....can you please help me out??
Is there any specific error being thrown?
Maps gets updated due to the below line in the code. Will suggest to debug the code and check whether the below line of code is being executed when the Locations is updated.
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
For reference, the complete source code shown in this tutorial is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Hi - thanks for this informative video. Question please. Is it possible to write an android apk that can give you some telephone number's location without them knowing. That is say i have your number X in say India. Can I find your phone's latitude and longitude by using GPS apis and your network operator? Since the operator knows where that phone is located!!
Yes, everything is possible. In simple words it is called hacking. You will have to develop all these functionalities and then run those methods using background process so that the user of the device is not notified of running services.
programmerworld.co/android/how-to-create-background-process-in-your-android-app/
programmerworld.co/android/how-to-implement-workmanager-to-run-background-process-iswifienabled-in-your-android-app/
sir im working on a cllg project of this android studio and the video u made would be helpful a bit for me but could this msg send exact location with the msg to the person we want without entering the phone no
Yes, you can send the message without hard-coding the phone number of the recipient. You can access the contact list for the same.
Please refer to my below video on how to access contact list:
ua-cam.com/video/cgVTbF15YlE/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
Sir, will this app keep on sending location every 1 second on a change of 5 metres?
Yes, this App will send location update every 1 second or 5 meters distance change. You can change these settings by changing the values of variables - MIN_TIME and MIN_DISTANCE - in the Java code.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld
While sending the SMS, if the user checks the Remember my choice checkbox, will all the next sms be sent automatically without asking the user's consent?
@@RockStar-ll8qp Yes.
-
Adding the code below:
MainActivity.java
package com.example.myyoutubelocationapp;
import android.Manifest;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.telephony.SmsManager;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private LocationManager locationManager;
private LocationListener locationListener;
private final long MIN_TIME = 1000;
private final long MIN_DIST = 5;
private LatLng latLng;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS}, PackageManager.PERMISSION_GRANTED);
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED);
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.INTERNET}, PackageManager.PERMISSION_GRANTED);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
try {
latLng = new LatLng(location.getLatitude(), location.getLongitude());
mMap.addMarker(new MarkerOptions().position(latLng).title("My Position"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
String phoneNumber = "99999";
String myLatidude = String.valueOf(location.getAltitude());
String myLongitude = String.valueOf(location.getLongitude());
String message = "Latitude = " + myLatidude + " Longitude = " + myLongitude;
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber,null,message,null,null);
}
catch (Exception e){
e.printStackTrace();
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
};
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
try {
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME,MIN_DIST,locationListener);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,MIN_TIME,MIN_DIST,locationListener);
}
catch (SecurityException e){
e.printStackTrace();
}
}
}
Sir, when I am trying this on Android Studio, it says "uses or overrides a deprecated API
Recompile with -Xlint:deprecation for details"
There might be some APIs deprecated now in newer version of Android. You may have to take care of them.
If required, you can also refer to the complete source code for this tutorial from below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld
Sir, the onStatusChanged() method has been deprecated. Writing @Deprecated instead of @Override on onStatusChanged() method removes that error. But the app is not starting.
@@RockStar-ll8qp Place a try - catch in onCreate method and try to read the exception which is being thrown. That may give a hint on possible issues with your App startup.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld
Still not working. I have written the exact code you have written. Changed the @Override to @Deprecated for onStatusChanged(). The Build Output is showing no error. Just the emulator says TestApp14 (the name of this app) keeps stopping. I have used try - catch as advised by you. But still the same result.
Hi, sir, thank you for your good explanation, its very good. But how can i do this but with using mapbox? Google maps is not free for me to use plus we need to put the billing info first, so i just used mapbox. Can you please teach me how to do this tracking things with mapbox and the sms notifications too? You can just email me if you want or reply to me here. Thank you so much.
I live coded along with your video and the app worked fine with few issues:
1) Numerous number of markers appeared on my map screen.
2) The app kept on sending text messages (over 7 messages before I could turn OFF the internet connection).
3) As shown in the video, it did NOT prompt any permission requests. When I attempted to code that part, it asked for API greater than 23. I'm running the app on my phone which is android version 5.1 (API 22).
My question is:
a) How do I fix Problem 1? (i.e., the marker should point to the accurate location). By the code it seemed for every 1 second/5m change, the location gets updated? So, I'm assuming, the marker should only be drawn on latest location? How is that possible?
b) Is there a way to code such that even lower APIs will ask for permission?
c) Do you have any resources on how to send notification (e.g: position coordinates) to the other users of the app (from within the app)?
Find the response in-lined below:
a) How do I fix Problem 1? (i.e., the marker should point to the accurate location). By the code it seemed for every 1 second/5m change, the location gets updated? So, I'm assuming, the marker should only be drawn on latest location? How is that possible?
Just use mMap.clear command before the AddMarker command. The clear command will ensure all the existing markers are deleted from the Map before adding the latest one.
b) Is there a way to code such that even lower APIs will ask for permission?
The App should prompt for the location permission. Location permission can't be acquired implicitly by the App (due to privacy policies) unlike some of the other permissions (like access to the Internet).
Having said that, the App will ask/ prompt for the permission only for the first time after installation. Once permission granted it will not ask again.
Uninstall and install a fresh App. It will prompt for the permission from the user. Otherwise go and check the permissions in the Settings. The location permission shouldn't be available for the App.
c) Do you have any resources on how to send notification (e.g: position coordinates) to the other users of the app (from within the app)?
For sending the in-App notification you need to set up the Push notification mechanism. For that you will need a server which can push the notification over the internet. In this video the focus has been to make it work offline (no internet needed).
I hope above helps you.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld thank you for responding quickly.
I understand when you say app shouldn't be given permission. But by default it didn't ask for any permission as shown in the video. Might be something related to my version [5.1 api 22]? When I checked the settings it was given whole network access and sms app permission [which will cost]. I don't know how though.
This works without internet? 😯😯 does that have anything to do with coarse location?
@@ProgrammerWorld have you posted any tutorials on using server with android studio? Couple of people suggested to use firebase for the push notification that you mentioned.
Thank you again!
Network permission is fine. But location and SMS permission is not possible to be granted without explicitly asking it from the user. Anyway, as suggested in previous comment as well, uninstall and reinstall the App. It should ask the permission.
Yes, this works without internet. You are right. It takes the coarse location information using the GPS data of the phone.
Cheers
Programmer World
programmerworld.co
-
You can refer to my below video for Firebase database usage:
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
Thank you so much for the demo, sir!
Hello sir, I'm currently working on GPS Tracking App, I've followed your steps but I want to make it counts/tracks how much Kilometers I have travelled, I don't know the code to make it, Would you mind giving me the answer? Thank you, Have a great day sir.
All project is well sir but how to add a new functionality like automatically send your location for a specific mobile number or already store number
I think that is what is shown in this video. You can hardcode the mobile number to which the SMS should be send automatically. You can also configure/ set the time interval of such SMS updates to be sent.
Further, you can watch below video which shows steps to store the location coordinates on Firebase database on a regular basis:
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Cheers
Programmer World
programmerworld.co
-
Hello, i just finished the project and its work thank you so much but why he does not show me the exact location! and can i add
something else in the sms?
The App should show you the exact location. However, if you are running your App on emulator then it will show initial location at Sydney because that is the starting marker position we have set in the code. And later it will move the marker position to California because emulator is not able to give you the location info as it doesn't have GPS or network data. So, it moves to some Pre-defined location in emulator.
However, if you try running it on your real phone, then it should definitely work. For the first time you may have to go in some open space to get nice view of GPS satellites.
Regarding SMS, yes of course you can send more information. While composing your SMS string "message" feel free to add your additional texts.
Okay thank you for helping but he doesn’t give me access to choose the phone. automatic execution with emulator and for the sms can i a text with the name of the location ??
Oh ... ok. To run your application on your phone, you will have to build the APK (Android Package) file. Then install the App on your phone using this APK file. Then your App will be ready for use on your phone in standalone mode.
For steps to create a APK file please watch my below video:
ua-cam.com/video/5c7odVDNHj0/v-deo.html
For steps to install the App please watch my below video:
ua-cam.com/video/StswYn4GSzk/v-deo.html
Hope above helps. Good Luck!
Regarding the name of the location, I am not sure how to get the name of the city from the latitude and longitude information. As long as you are able to retrieve that information, you can edit your message string to add the name of location in your sms.
Hey, I wanted to ask that, in this video Latitude and Longitude is sent via SMS but how can we send a proper link through which receiver can click and get the location in Google maps?
I mean link for current location just like we use to send in whatsapp?
please help me I am stuck.
Thank you
You can send it in the form of below link:
maps.google.com/?q=,
The details are given on my below webpage:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Also, it is mentioned in one of the previous comments.
Cheers
Programmer World
programmerworld.co
-
Hey, I'm working on a project that requires a similar feature.
I have a little issue:
When I send a sms, my latitude and longitude display as 0.
Could you tell me how I can fix this?
That's because the location is not getting updated in your App. There could be multiple reasons for this.
Request you to please check the below page for source code:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Also, below page can be referred for an alternative method to fetch the location coordinates:
programmerworld.co/android/how-to-get-the-device-last-location-using-gps-network-without-using-map-layout-in-your-android-app/
Hope above helps.
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld Thank you for the response. I actually figured it out.
Sir is it possible to send the location in the message without opening maps. Also if you could tell is it possible to know the nearest police station?
You can use below API to get the location without using MapsActivity:
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
fusedLocationClient.getLastLocation().addOnSuccessListener();
Good Luck
Programmer World
programmerworld.co
-
do you have a new source code for the new version of android studio?
Sir do you have demo how to send current location via SMS like whatsapp..?
Sending WhatsApp messages cannot be completely automated by the intent as WA does not allows it. However, at least the text can be copied in the respective chat. Please refer to the below:
programmerworld.co/android/how-to-share-file-or-text-on-gmail-whatsapp-sms-bluetooth-from-your-android-app-share-button/
programmerworld.co/android/how-to-open-start-another-app-such-as-gmail-whatsapp-sms-facebook-from-your-custom-android-app/
For reference, the complete source code shown in this tutorial is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Hello Sir! We are trying to make a tracking system app that can be use in an off-grid places, Can you give us some advice on how we could track other devices and send them a message or a notification with no signal at all? We are planning to use Wifi triangulation method? Is it possible? Can you help us? Thank you!!
Better than Wi-Fi triangulation, why don't you try to use Bluetooth method to connect to the nearby devices. This method is very much used for location tracking in indoor setups, no-network or even congested network setup. Using the Bluetooth one can also transfer the messages even when there is no network available. The only caveat of this approach is that you will need a network of closely placed phones which are ready to share their Bluetooth network with your App. This is tough to implement but possible.
Regarding Wi-Fi triangulation, one advantage will be that there are ample of solutions available over internet. So, you can try them as well.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld Thank you for the response bro!
@@ProgrammerWorld Hey bro do you have some codes about the bluetooth method?
Do you have a demo where you find nearby places like restaurants and such using google maps, could really use a tutorial for it
Below tutorial shows how to get the address of the current position:
programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/
Probably, using this concept it will be possible to build a database of nearby places/ point of interest (such as restaurant, hospital, etc.) and show them on the Map.
Cheers
Programmer World
programmerworld.co/
-
sir my project is about track vehicle using gps tracker device. can i just follow this tutorial? but did you know how to integrate the gps tracker device?
Yes, you can use this tutorial to design your tracker application. You can also watch my below video on tracking if you want to store the location information in some database like Firebase (of course internet access will be required to access database servers):
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Regarding integration, every GPS tracker device has different settings. So, it depends the GPS device you are using. Best will be to go through it's manual.
I hope above helps.
Cheers
Programmer World
programmerworld.co
-
Hi sir, in this app. Is the map going to refresh whenever the location changed?
Yes, the map will automatically refresh on the change of the location. But this cannot be tested on an emulator because the sensors (location sensors such as GPS) are not available in emulator. So, to test this please use a real phone/ device.
Cheers
Programmer World
programmerworld.co
-
Hi Sir which language is this? i'm working on a similar project but with Java language
This is also Java language. It is written in Android Studio IDE for Android App.
For reference, complete source code and details shown in this video is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Hey There, i have implemented as like you in my app, but in coordinates the latitude points to 0.0,Is that a correct one or do i need to change anything else??
No, that's not correct. Latitude and longitude should show your actual location coordinates. Only if you are exactly at equator, your latitude will show up 0. But that is very rare.
So, my guess is that your App is not getting location access permission in your phone. I will suggest you recheck your code. If possible refer to my code shown from below webpage:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code
I hope it helps.
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld There is a small mistake in your code, in there exactly you have gave a method to find the altitude() but while changing to string and calling the you have gave it as latitude, this gives a confusion to the method that why the altitude is 0.0
Oh, yes I remember this. Initially while creating this video by mistake I used Altitude instead of Latitude. I corrected that in the later part of my video. Sorry for any confusion.
I hope other people don't get confused with this.
Anyway thanks for pointing this out.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld Do you know to code for turning on GPS not the location?
@@imuksd This functionality is in my list. I will soon present a tutorial on this topic to switch GPS on and off programmatically from your Android App.
Cheers
Programmer World
programmerworld.co
-
Hi bro, latest bumblebee version of Android studio.. doesn't have Google.api.xml file.. so how do we proceed in such cases
If maps layout is not needed then below page can be referred to get the location coordinates in your App:
programmerworld.co/android/how-to-get-the-device-last-location-using-gps-network-without-using-map-layout-in-your-android-app/
Cheers
Programmer World
programmerworld.co
-
thank you sir for doing this wonderful stuff. Please could you show me an app that can track the location on backgkround?
Refer to below tutorial to run an App in background:
ua-cam.com/video/tFGlLa2fwNQ/v-deo.html
Or below videos for foreground running of the App:
ua-cam.com/video/MRm6NgZlmDc/v-deo.html
ua-cam.com/video/xxC4-BLNSSc/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
Hello, I am doing a similar tracking app but I need to keep the app working in the background and continue receiving the data if the user leaves the app or blocks the cell phone. Could you give me some advice on how to do that? Or do you have a video where you explain it?
You can watch my below videos to run an App in background.
This video explains how to run an App in background as foreground services: ua-cam.com/video/MRm6NgZlmDc/v-deo.html
This video is another example which shows how to use broadcast and notification in foreground service: ua-cam.com/video/xxC4-BLNSSc/v-deo.html
Hope above helps.
Good Luck
Programmer World
programmerworld.co
-
Hi sir, how about track location of object for example vehicle using gps neo-6m? is this the same way to exchange location data? Pleasee notice me sirr
Yes, concept remain same. The only challenge will be to get the data from device or chip (like neo-6m GPS) and send it to over SMS or through server (Firebase database). You may have to check how to get the data from the chip to your Android App.
For steps on exchanging the data over the Firebase database one can refer to the below link:
programmerworld.co/android/create-location-tracking-android-app-by-exchanging-location-information-over-firebase-database/
Cheers
Programmer World
programmerworld.co/
-
@@ProgrammerWorld thank you very much sir for your help.
Hi sir, may i ask why i followed your source code and successfully run, the google map running on virtual device doesnt show map, only blank white screen ya
Sometimes it may take time for the map to get downloaded and set in your App's map layout. So, give it some time to get the map loaded.
For reference, the complete source code shown in this tutorial is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Hello sir I need your help for my project
My project is about women safety app and just by clicking on emergency button it should send location to the all three contacts that are save
mam , im also doing that same project ..can you sent me the source code of yours?
omg mam we are same. i doing it for my final year project. i really need help
@@amirul7411 sure mam....how will you send me the code ??
@@gerlynm50 im still doing code but i only got one two parts that ive been working on. Give me your email and ill contacy you over there to see how i can help as for my part.
@@amirul7411 geeks5vlog@gmail.com oke mam
Sir, here in this app, sms is being sent to only one number (i.e which is defined in the coding) but how to take the number as input during runtime. I tried by adding another activity(main) where the user will enter a phone number where the sms is to be sent and finally he will click the submit button and then the MAP will be loaded and SMS will be sent to the entered phone number. But in my app as soon as the submit button is being clicked, the app is being closed. Can you say sir, what can be done ?
It is pretty simple. Just insert an EditText in the layout and take the input from the user. Read the content of EditText in the Java code and use that number to send the SMS.
For example on how to insert widgets in the maps layout, below tutorial can be referred:
programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/
Hope above helps.
Good Luck
Programmer World
programmerworld.co
-
sir im from philippines can you help about my project name of Skylab app tracking the user open his location and the admin passenger
will notify where is he using sms?
I think how to send or update one's location through SMS is shown in this video. So, this concept can be used to implement the project for tracking users. If any specific query is there then please let us know.
Cheers
Programmer World
programmerworld.co
-
Sir I want to develop an app such that if we shake our mobile location will be sms Ed to the registered number and even call is placed . Can u make a video on this
Yes sir I want same
@@aakashtyagi3990 bro did u complete that
Sir, is it possible to send the exact location in whatsapp from our app? Not as text, but as a map interface, just like whatsapp live location.
I think it should be possible. Just send the location info in the gmap url format over any communication channel. For sending message over whatsapp, the below link may help:
ua-cam.com/video/XvH748sImco/v-deo.html
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld
Thank you so much sir
I want to know this for apikey generation whether we need to billing acount in google cloud platform because it giving billing need to enable responce when i use this api key for reverse geocoding api request and getting location address...at first tested in postman it gives me that error responce (billing account to be enabled)....Is this is payable one?
Can anyone please clear me out on this
AFAIK for small scale (non-commercial) purpose google provide this API Key for free. You will be charged only for high usage. As shown in my videos, the steps are for getting the API Key for free. You can refer to my other videos also on this topic. Links posted below:
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
ua-cam.com/video/rN7x3ovWepM/v-deo.html
Hope it helps.
Good Luck
Programmer World
programmerworld.co
-
Good Day Sir! Is it possible to add a function that automatically sends your location to a specific number through sms ?
Hi Ken,
That's exactly what is shown in this video. Here, in this tutorial it creates an App which sends the updated location info (latitude and longitude) to a pre defined number through sms.
In conjunction to this video you should watch the next part using the below link where it shows how to convert latitude and longitude information to an actual address:
ua-cam.com/video/Nsl99WWDFxM/v-deo.html
@@ProgrammerWorld did you have to pay in order to send sms
@@niamhmcnulty1774 Yes, normal sms charges will apply for each message sent. I have unlimited free message plan, so it's practically free for me. 🙂
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld
😆😆😆😆
sir cant we send automatically to the persons is contact and does that also needs the number to be saved in the code
No, not necessary. The contact number of the recipient need not be saved in the code. You can access the contact for the same.
Please refer to my below video on how to access contact list:
ua-cam.com/video/cgVTbF15YlE/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
I need similar app but the one that fetches current google maplinks and send it as both sms and email.
How to mark location on the map and send notification if we are in the particular marked location
In the code shown in this video, the location will automatically be sent whenever there is an update in location information. This is taken care in the onMapReady method. In this example it does not show any manual triggers, such as buttons, etc. Location will be updated based on any of the conditions (MIN_TIME,MIN_DIST) defined int he code is triggered.
If you need to implement a manual trigger/ button click in the maps layout then one such example is shown in the below page:
programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/
Hope it helps.
For reference, the complete details and source code shown in this video is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Sir, I am running this code, but only one permission is working.. If I write send_sms first , then location is not working but if I write location permission first, then sms service is not working.. What to do?
Also, for how long will it keep tracking?
Sir, I am running this code, but only one permission is working.. If I write send_sms first , then location is not working but if I write location permission first, then sms service is not working.. What to do?
- Ideally it should work. I assume you have made the declaration in the Manifest file also.
However, if it is really giving issue then try below approaches:
1. Split the permission method to individual permissions. Something like below:
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS}, PackageManager.PERMISSION_GRANTED);
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED);
2. If it still gives issue then use an IF condition to check for the permission, something like below:
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.SEND_SMS}, PackageManager.PERMISSION_GRANTED);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED);
}
Also, for how long will it keep tracking?
- It will keep tracking as long as the App is active. So, there is no time limit to it. It is similar to any map based App (like google maps or Uber).
For reference, the complete source code shown in this tutorial is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Hello sir, is it possible to send an SMS but i want the message to be a google map link....instead of sending the longitude and latitude!
Then form the google map URL string and send the string in the message (SMS).
I think the format of the URL is:
maps.google.com/?q=,
Below is the example URL for -
Latitude = 41.24
Longitude = 2.06
maps.google.com/?q=41.24,2.06
A bit processing may be required to get the string in above format.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld okay thanks sir, one last question....
i'm getting ERROR like this: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:17.0.0.
Sir, I am facing a problem, actually the app is working and sending sms also but the MAP is not loading. Previously it was working well i.e MAP was also loading and sms were being sent as well but thereafter I uninstalled it and made some changes and since then MAP is not loading. Thereafter again I wrote fresh code (ditto what you have shown) although the app is sending sms but MAP is not loading. What is the problem sir. My phone is Redmi note 8 pro. All permissions are already given including location (manually from settings).
Sorry, but it should have worked after re-installation. Few things which I can suggest:
1. Try uninstalling the complete App along with the App data deletion and then go for a fresh installation.
2. Also, in the new APK file, increase the version of the App (by changing the version in the gradle file). Increase it from 1.0 to say 2.0 and then try to install the new APK file. In this Android will take it as an advanced version of the same App and would handle the App data/ permissions better.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld Thank You Sir for your reply. Now I understood what was the problem there. Actually I was copying same Google MAP api for different projects. I copied the url and generated a brand new api and then Bingo... It worked. Keep going sir. Big fan of yours. 🙏
Sir, here in this app, sms is being sent to only one number (i.e which is defined in the coding) but how to take the number as input during runtime. I tried by adding another activity(main) where the user will enter a phone number where the sms is to be sent and finally he will click the submit button and then the MAP will be loaded and SMS will be sent to the entered phone number. But in my app as soon as the submit button is being clicked, the app is being closed. Can you say sir, what can be done ?
Sir, Can we send live location without using sms ?
Of course there are many ways. One of the other way (through Firebase database) is presented in the below link:
programmerworld.co/android/create-location-tracking-android-app-by-exchanging-location-information-over-firebase-database/
Hope it helps.
Cheers
Programmer World
programmerworld.co
-
Hello sir, how can I add a user input to get the phone number i want to send the location?
Below page may help. Please refer:
programmerworld.co/android/how-to-send-sms-automatically-from-your-phone-by-programming-in-android-studio-java-code/
Cheers
Programmer World
programmerworld.co
-
sir, please help me for my project.
if the bus driver (bus) is at a particular distance from the user then user should receive a notification regarding the bus.
how to code for this.
Just get the coordinates of both the phones using GPS. Then compute the distance between the two and if this distance is less than the threshold then raise the notification.
You can transfer the coordinates (latitude and longitude) of drivers phone to user's phone through sms as shown in this video.
For details on how to read the SMS, you can watch my below video:
ua-cam.com/video/K9IloJ_66WI/v-deo.html
thankyou sir
sir, right now I am unable to code .
can you provide the code sir.
@@tejagudivada6847 I don't have the code ready as of now.
sir can you please tell me how can we send the location name along with the location coordinates through sms
Watch my below video which gives steps on how to convert latitude and longitude to an actual address using Google map's Geocoder API:
ua-cam.com/video/Nsl99WWDFxM/v-deo.html
Good Luck
Programmer World
programmerworld.co
@@ProgrammerWorld the above video is helpfull in converting the longitude and latitude but how can we send the location info with that of the longitude and latitude through sms on our desired number ?
@@sahilbhat8273 You can use the same concept shown in this current video (track your location using GPS and send it over sms). The only thing is you have to modify is the message string to include the location details along with latitude and longitude.
You should change below line in my source code to include the output from the Geocoder:
String message = “Latitude = ” + myLatidude + ” Longitude = ” + myLongitude;
The complete source code of this tutorial is shared at:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
I hope the above helps.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld Thanks
Sir is it possible to create a one tap button to trigger the sms ?
I think my below video may help you with sending SMS option:
ua-cam.com/video/pajvuBZc2WA/v-deo.html
Cheers
Programmer World
programmerworld.co
-
Good Day sir, how to convert the longitude and altitude massage in to a City and address thank you for your videos thumbs up
We can use Geocorder API to translate the latitude and longitude to the address. We can get the address using the below command:
geocoder.getFromLocation(latitude, longitude, 1)
Alternately, you can also use below command to show the location on map:
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
I will try to create a tutorial for Geocorder command and let you know once posted.
You should see my next video from the below link. It shows the steps to get the location details from latitude and longitude
:
ua-cam.com/video/Nsl99WWDFxM/v-deo.html
Hello Sir, I have followed the whole video but I still faced one problem that when I turn on location service, the activity will crash. May I know the reason?
Try to debug and check for the reason of crash. Most likely the onCreate method is crashing. Better put a try-catch for smooth handling. Also, crashes during the start is most of the times due to null pointer exceptions. Please debug and check.
For reference, the complete source code shown in this tutorial is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
I designed an app that shows my location information,
I will be glad if you can help me how to write a code to send my location information as gmail.
Refer to my below pages. It may help:
programmerworld.co/android/how-to-open-and-send-email-using-the-native-client-directly-from-your-android-app-source-code/
programmerworld.co/android/how-to-send-email-using-gmail-smtp-server-directly-from-your-android-app/
Cheers
Programmer World
programmerworld.co
-
Sir the requestLocationUpdate functions at 20:45 in the video in try block are giving out an error "missing permissions required by location manager". How to fix it?
I think you have missed getting location permission from App's user in the Java code.
Add below line in your code as shown in the source code shared in the following link:
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, PackageManager.PERMISSION_GRANTED);
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
still getting this error
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
Selected remote version of com.google.android.gms.googlecertificates, version >= 4
I/DynamiteLoaderV2: [71] Googlecertificates
W/xample.locatio: Unsupported class loader
W/xample.locatio: Skipping duplicate class check due to unsupported classloader
E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@a5470ce[MapsActivity]
E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
@@antrashrey6049 It will be difficult to analyze the issue using only the given error message. Complete source code will be required to evaluate it.
Good Luck
Programmer World
programmerworld.co
-
Hello Sir I have just finished the project and the sms is not working if i run it in the Android Studio emulator. I mean I get no sms. Please could you tell me what to be done here?
Same problem is mine
In emulator the mobile service is not available. So, I don't think it can send SMS to a real telephone network. Emulator should be used to only test the concept.
Cheers
Programmer World
programmerworld.co
-
Programmer World sir thank you so much! I think this app will work offline without internet connection. And how will I follow the exact coordinates send as sms in real google map? And what about the phone number we give in the codes, am I suppose to change it to my exact mobile phone Number with the country code or I should keep the “99999” provided in the code? Please I hope you will help me I just want to know this!
Sir please help me,
the location is not changing, it shown in sydney only..
i gave permission to sms and it not reached the number.
Are you using your actual phone or emulator to test the App?
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorldmobile sir
Then please check if all the required permission, like access to location, is granted to the App. You can go to the App permissions in the setting of your phone to check this.
Cheers
Programmer World
programmerworld.co
-
is there a way to send this to an online database instead of sms?
That's exactly is shown in my below video (location tracking by exchanging location over Firebase database):
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
Sir my project is
When Battery level is low we should send location through SMS to contacts
Can tell me how do I do that?
Please refer to my below video on getting the battery level:
ua-cam.com/video/KAKn6XdMaxM/v-deo.html
Combine these two tutorials to complete your requirement.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld
Thank you
But battery program is for ringtone how do I integrate it with sms and send location
Instead of alarm, trigger the send SMS method in your code for certain battery level.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld
I am not able to do that😭
Sir what if I have to record and send audio through MMS manager to predefined number
For sending a file, below link might help:
programmerworld.co/android/how-to-share-file-or-text-on-gmail-whatsapp-sms-bluetooth-from-your-android-app-share-button/
For recording the audio, some reference is available in below link:
programmerworld.co/android/record-and-play-the-sound-simultaneously-live-stream-over-bluetooth-speaker-in-your-android-app/
Cheers
Programmer World
programmerworld.co
-
hello sir, how to connect android app to any GPS module and track the location of module.
Could you please let us know what do you mean by GPS module?
Do you mean any device which supports GPS like Car navigation? If yes, then if the device supports Android OS then you can develop the App using the steps shown in this video.
If you mean, any other App on your Android phone then that App should explicitly enable this feature of GPS tracking.
Cheers
Programmer World
programmerworld.co
-
Sir can we add this file to already built app code in android studio
For any App, there is only one main code/ class (MainActivity). So, a simple copy paste of this code into your existing code file would not work. You will have to integrate this as a separate class in your existing project and call it wherever required.
For reference, the complete source code shown in this video is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld thankyou sir
How to send the location on the gps page to other's phone number?
This is exactly what this video shows. One can refer to the source code of this video at the below page:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Also, the other approach to exchange data (of location) could be to use some kind of database, such as Firebase database example as shown in the below link:
programmerworld.co/android/create-location-tracking-android-app-by-exchanging-location-information-over-firebase-database/
Cheers
Programmer World
programmerworld.co
-
Hello sir, can we modify the code so that the process is reversed? I want to define a secret code message in my code. And if someone texts me that exact code message, then my app will send the gps co-ordinates to that number automatically.
Yes, of course it is possible. For that you will have to read all the incoming SMSes in your App and when you receive your predefined key word you invoke the location send method which will send the location to the number either hard coded or to the number received in SMS. For steps on how to receive and read the SMSes, please watch my below video:
ua-cam.com/video/K9IloJ_66WI/v-deo.html
The complete source code is also shared at below link:
programmerworld.co/android/how-to-access-sms-or-read-last-sms-in-your-phone-using-your-app-android-studio-java-code/
Good luck
Programmer World!
programmerworld.co/
-
Thank you so much :D
Sir, the SMS feature works on the emulator, but when I run the APK in my Honor 7A phone...sms is not sent and the below error is shown.
E/BufferQueueProducer: [] Can not get hwsched service
please help me.
Thanks for bringing this up. Yes, there are issues in running google services on Huawei phones due to restriction from US government. Huawei cannot use certain services such as Google play store. In this App, to access the location and map, one needs the access to the services from Google play store. So, the issue you are reporting is probably due to such restriction. I will check if there can be any workaround for the same and let you know.
PS: To overcome such restrictive challenges, Huawei is coming up with its own OS named HarmonyOS (Hongmeng in China). This may be the OS in their future phones.
Hope the above details helps.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld thank you sir, for enlightening me on this issue.
Bro how to send this co-ordinate on a website..Plz make a video on it soon
Thanks for the suggestion. I will definitely make a video (when time permits) to show the steps to send the location to a website.
Cheers
Programmer World
programmerworld.co
-
hi sir is there a way where i can save the infos of the person who is getting tracked?
I think you can use any database to store or record the information.
Below video shows how to do it using the Firebase database:
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
hello sir i am making my final year project on alcohol detection and it detects the alcohol percentage as driver breathe in the car. So i want to make an application that send the driver (who has drunk) current gps location to the police station, so does this above code will be satisfy the outcome of our project.
Yes, following the concept shown in this video will help you to implement your project as described. Based on the input from breath analyzer, the location data can be sent over SMS to the nearest police station. Also, if you want to store all such information in some kind of database then you can watch my video at the below link:
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Having database will help to do some analytics over the data which will be received over a period of time. Also, using database, the information can be accessed from various platforms simultaneously.
Candid confession - more than the technicalities behind this application, I really appreciate your idea of helping the society at large by avoiding/discouraging drunk driving on road. Cheers guys .... Keep it up.
Good Luck
Programmer World
programmerworld.co
-
Sir,the app is not getting installed in my phone.
In honor 6x it is showing "The package is corrupted" and in Mi phone it is showing "App is not installed"
Is it running successfully on emulator?
Just for information, the complete source code shown in this video is shared at the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld apart from emulator showing its location as California,everything is going well in emulator sir
@@alekhyaparimala5200 Yes California location is fine in Emulator. That is expected.
For your real phone, check if the minimum SDK of your phone (Android version) supports the min SDK of your App. You can check that in the gradle file of your project.
If the above is correct, then please try once again by re-building and re-installing the APK file.
Good Luck
Programmer World
programmerworld.co
-
message is not sending in my mobile i gave all the permissions properly and its showing too many locations of the current position
For the SMS issue, I will suggest first try to create only an SMS App and see if it works. Then you can combine the SMS App with the Location App. The complete code for the SMS App can be found in the below link:
programmerworld.co/android/how-to-send-sms-automatically-from-your-phone-by-programming-in-android-studio-java-code/
For your 2nd question, you can clear the markers before adding a new marker to the map. In this way you will only have one Marker at a time on the Map.
Sir im facing an error it’s not sending the SMS but there’s no error on the code
Check if SMS permissions are granted to this App. If yes, then debug your code and check if the below line of code if hit or not while debugging:
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber,null,message,null,null);
The above code lines are from the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld thanks sir i solve the issue but now im facing another problem. How can i put a button to invoke the google map activity but without going to the interface of the google map? And how can i stop the function from the same button
I have created a log in / sign up page
How do I add this part inside my app
Please refer to my below video page:
ua-cam.com/video/2xyNawgIk7Q/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
brother i have a question does this app require internet to work
No, internet will not be required. Location information will be received through the GPS and the information will be transmitted using the SMS. So, no internet will be mandatory for the operation of this App.
Good Luck
Programmer World
programmerworld.co
-
sam as it to create a simple school bus tracking system.
sir it is showing error when we press sync now option and those errors aren't getting resolved at all
Can you please share the error text you are getting?
Also, can you please let us know what you mean by sync now option. AFAIK, the location info will be send automatically over sms on regular interval.
Cheers
Programmer World
programmerworld.co
-
Sir I will just mail you the errors . Please look into it sir and thank you so much sir for replying very soon
Is there a way to track a different device by using its phone number? How would someone code an app that does that?
Yes, it should be possible. Just install this App in the phone to be tracked and give all the required permission.
Then you can automate the SMS reading using the code shown in below link.
programmerworld.co/android/how-to-access-sms-or-read-last-sms-in-your-phone-using-your-app-android-studio-java-code/
So, based on the certain key-words in the read SMS (Say "Location") then send the location to the required phone number through SMS using the concept shown in this tutorial.
Hope the above helps.
Cheers
Programmer World
programmerworld.co
-
Its sending more than 1 message till the location is on . what to do?
Simply adjust the below variables in your code:
private final long MIN_TIME = 1000; // Every 1 second the SMS will be sent
private final long MIN_DIST = 5; //At a change of every 5 meters will be sent
If you want the message to be sent more seldom then increase these two values.
Say:
private final long MIN_TIME = 1000000; // 1000 seconds (16.66 mins)
private final long MIN_DIST = 500; // 500 meters
In above, the message will be sent either every 1000 seconds or on a change of 500 meters whichever is earlier.
For complete source code shown in this video, one can refer to the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
What is the code of User define mobile number for sending sms
Just insert an editText in the layout and take the number entered by the user in the editText to send SMS.
Hope above helps.
Cheers
Programmer World
programmerworld.co
-
Sir is it work even when the mobile is switched ofd
No, when mobile is switched off then it will not work.
However, even if you move away from this App to work on another App with mobile switched ON, this App will continue to work in background and will send updated location info SMS regularly.
Good Luck
Programmer World
programmerworld.co
-
For some reason my app isnt sending an sms tho I followed all the steps & had no errors
You are trying in emulator or actual phone?
Check if you have given all the permissions to the App like reading and sending SMSes. In worst case I will suggest to debug the code and see if any exception is thrown.
Nvm,its working nw.It didnt work in the emulator but works on my phone & actually sent the sms.But its taking long to get the location coordinates.
@@nahush6299 Make sure you have given both the access - Fine location and coarse location - to your phone. This should fetch the location faster.
brother can you tell me how to send current location in the form of link
Convert your string in the below format:
maps.google.com/?q=,
Below is the example URL for -
Latitude = 41.24
Longitude = 2.06
maps.google.com/?q=41.24,2.06
A bit processing may be required to get the strings in above format.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld thank you so much brother
brother it worked fine i used URL class to convert string in the url
how are you, sir? I hope you are fine. please, can you help in my project?
Sure, tell me more about the requirement of your project. You can also contact me at my email ID: programmerworld1990 [at] gmail [dot] com
Sir plz make video on how to find location of others by sending sms
Getting the location of other mobile by SMS would be possible if and only if that mobile has granted access to its location. If the required permission is granted then a custom application can be created which reads the SMSes. When it receives the specific SMS then it fetches the location and sends the coordinates back through SMS. This workflow is possible and I will try to make a tutorial on this and let you know once I post it.
@@ProgrammerWorld thank u sir
@@ProgrammerWorld sir I had made an application that does exactly that but google rejected it stating that app must be default sms handler .since it uses receive sms permission .I got the permission declaration form and didn't know that to do.
@@OmarAhmed-jo1cf The complete source of this project is shared at the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
I will suggest you to once verify your code including the Manifest file and compare it with that shared by me. If still you are getting the issue then I will suggest you to post your complete code and I will have a look at it.
Cheers!
If you got to know how to do it please let me know.
this app has needed to link to firebase?
cause it not working
No, this App works in offline mode. Not needed to connect to Firebase database.
You can refer to the below video for Firebase concept:
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Cheers
Programmer World
programmerworld.co
-
Sir how build android app to send data to website?
To which website the data needs to be sent? If you have the access to the database of the website, then you can of course configure your App to directly write to the db. However, can you please clarify how do you want to access the website?
Sir, In this app track location without internet
Yes, it will track without internet. It will use SMS service for communicating the location.
Cheers
Programmer World
programmerworld.co
-
Sir, here in this app, sms is being sent to only one number which is define in the code. How can i create a list of predefined contact and the sms will only send to these stored numbers without having to insert the phone numbers again
Simple, just repeat the below line in your code for each number to which the SMS should be sent:
smsManager.sendTextMessage(phoneNumber,null,message,null,null);
To create a list of pre-determined phone numbers, just use a Macro and repeat the above line in the code for each number in the macro.
For reference, complete source code shown in this tutorial is shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Sir, how to enable this app send sms even when the screen is locked?
This App should send the messages even with screen locked. Try it.
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld
Sir, I have tried but it is not sending the sms when screen is locked. I have combined Geocoder with this program. Is this happening due to Geocoder?
@@RockStar-ll8qp I doubt that it is happening due to GeoCoder API. I will have to check on this and then will confirm it.
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld
Thank you so much sir
@@ProgrammerWorld
Sir, have you gone through the issue?
how to convert latitude and longitude in maps link?
Convert the string in the below format: maps.google.com/?q=,
Below is the example URL for -
Latitude = 41.24
Longitude = 2.06
maps.google.com/?q=41.24,2.06
A bit processing may be required to get the strings in above format.
Cheers
Programmer World
programmerworld.co
-
Sir it is sending message every second even though i am not opening the app
Once you start the App, it will remain active in background even if you have switched to another app or your home screen. To stop it you will have to explicitly kill it through task manager of your phone.
Regarding the frequency of message, right now in my code I have used MIN_TIME = 1000 ms. You can increase it to your requirement. Otherwise with current setting, it will send the sms every 1000 millisecond (1 second).
I hope above explanation helps.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld i force stop it but it still sending message is it possible to remove the MIN_TIME cause i just want to send the message only one time.
@@MakeSenceHindi Once the App is force stopped or killed, then that process is not running and hence it should not send SMS. I am not sure how a task is being executed when the process itself doesn't exists as it is killed. Please check or kill all the Apps in Task manager and review. It should NOT send messages once the process is killed.
Regarding MIN_TIME parameter, I don't think it is possible to avoid it. It is mandatory argument in the requestLocationUodate API. Though, to solve your issue you can give it a very large value practically making it infinite and hence will never reoccur.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld By putting a large number its delaying the time of showing the current location of user..btw thanks for the help sir
Sir I'm not getting notification to send location as SMS . How to solve that ?
Hi Lalitha,
As far as I understand, the code shown in this tutorial does the job of sending the SMS automatically whenever there is a location change and "onLocationChanged" method is called. Please refer to my complete source code shared at the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
However, if you want a manual control of sending the SMS, then you can simply put a button in your layout and in the onClick method of that button you can implement the send SMS code. Something similar is shown in below code (albeit for getting the location details and not sending SMS):
programmerworld.co/android/how-to-convert-latitude-and-longitude-location-to-an-actual-address-and-show-on-map-in-android-app/
Hope above explanation helps.
Cheers
Programmer World
programmerworld.co
-
how to send the current location via whatsapp?
Once the location is obtained using the concept shown in this video, one can use below concept to send it via whatsapp (or any other app such as gmail):
programmerworld.co/android/how-to-share-file-or-text-on-gmail-whatsapp-sms-bluetooth-from-your-android-app-share-button/
For reference, the complete details and source code shown in this video is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Sir I am getting Error on Activity.requestPermissions its not giving me the suggestions of requestPermissions
Is this issue for SMS permission or location permission?
In the Google map activity, it may be taking the location permission implicitly. Also, if you have granted the permission once then on restarting the App or reinstalling the App it may not ask for the permission again.
@@ProgrammerWorld Thankyou Sir For your quick responce! Sir Iam getting the location and it keeps updating but its not Sending the message of location!
@@cslearners9947 Then check your SMS permission. Either you have missed to define that in the manifest file or missed getting the permission from the user in your java code. If you still have issues then send your code or refer to the below webpage for complete source code:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
-
@@ProgrammerWorld Thankyou Sir! My problem is solved!But i have a question That ow does these longitude and latitude will take me to the location?on google map..
@@ProgrammerWorld And Again i appreciate your work! And in request to plz make the video on Sending messages to numbers from FireBase! Thankyou In Advance :)
Sir, may I know your good name, please🙏
Sir how to send emergency msg with location to other number
I think you are referring to the right video. Here, it is explained how to send SMS to pre-set emergency phone numbers along with your location details.
Good Luck
Programmer World
programmerworld.co
-
@@ProgrammerWorld sir tat means if i use this code then it will send both msg nd location
@@MeeraMoments Yes.
@@ProgrammerWorld sir how to add map activity if i have already started project with other activity
@@MeeraMoments Create a class with Map Activity. Make sure you have defined this Map activity in your Manifest file. Then start this Map Activity from another activity using StartActivity method. This is a bit tricky but the steps are simple. (I don't have a tutorial o this right now).
Good Luck
Programmer World
programmerworld.co
-
hello by this code i am unable to fetch my current l
oaction
This code works for most of us. Are you getting any specific error or issue? Have you given permission for access to location both in Manifest file and java file? Please check these in your project.
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld i received my current position
N thn again n run the program then i am not, getting the current position.
No error activity is running but output is not cuming
I gave permission as well
And i did sms wala code as well but i. M not receiving any msg
I gave permission for this as well
If it has worked once then it should work again. Your App code is correct.
I will suggest, try to go in open where you have clear access to GPS satellite. This will ensure that your App gets your location info.
Regarding SMS, please check the mobile number is correctly coded in the App's code. I will repeat that if the SMS has worked once then it will work again.
Good Luck
Programmer World
programmerworld.co
-
Sir how to take the phone number from the firebase an send the message
Better to directly put the number in the code or take the number from user as an input from the layout.
However, if you still want to interact with Firebase database, you can refer to my below video:
ua-cam.com/video/hyi4dLyPtpI/v-deo.html
Good Luck
Programmer World
programmerworld.co
-
Where we tracking it's not tracking
Then GPS signal might not be available there. Check if your GPS access is working.
Cheers
Programmer World
programmerworld.co
-
Sir how can I track my family phone number.
You will need to install this App on their phone with your phone number to receive the SMS. Bingo! Then you can track their whereabouts.
For reference, the complete source code shown in this tutorial is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
Sir i have a doubt
Yes, please let us know about your query.
We will be glad to look in it.
Good Luck
Programmer World
programmerworld.co
-
Share a code please
Complete Source Code is available at below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
comments begging for help should be banned.
Just curious to know, any specific reason behind this comment?
I think we should see this as a platform to exchange knowledge rather than just a forum to seek help.
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld sorry I've been looking at several coding tutorials today and the comment sections are littered with people begging for help in bad grammar. Its irritating because its not the video posters job to help hundreds of inept students with their projects. They need to help themselves or at least speak in complete sentences.
@@rhetorical_annihilation Yes, I agree with you. These videos should be seen as a platform to exchange ideas and knowledge and not just an easy way to get your school project done.
Thanks for your inputs.
Cheers
Programmer World
programmerworld.co
-
Sir i am student i am working on some project similar to this i need your help I'll contact you with your mail can you please check and respond accordingly hope you will help me out and i need your help very badly
Can you please elaborate your requirement and we can point to the right video or webpage for that implementation.
For reference, details shown in this video is also shared in the below link:
programmerworld.co/android/how-to-track-your-location-using-gps-and-send-it-over-sms-in-your-andoid-app-complete-source-code/
Cheers
Programmer World
programmerworld.co
-
@@ProgrammerWorld sir i need auto reply message to send the coordinates to the particular friend.
For example
I need my phone gps coordinates
And i lost it somewhere
So i will send an sms to my phone from my friend phone to "send me the coordinates" it should send me back the coordinates dynamically