Sendig geolocation via SMS

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Sendig geolocation via SMS

Postby cogalian » Mon Jun 13, 2011 5:43 pm

Hi guys, is it possible to get and send the gps position with sms message? I don't find something like this...
cogalian
Developer
Developer
 
Posts: 40
Joined: Mon Jun 13, 2011 5:40 pm

Top

Re: Sendig geolocation via SMS

Postby abhijitphatak28 » Tue Jun 14, 2011 5:54 am

I think your question is not clear to me, but yes we can can geolocation of the device and can send those co-ordinates through SMS.

If you could elobarate your question, will provide you implementation details.

Thanks

Regards
-Abhijit
User avatar
abhijitphatak28
Senior Developer
Senior Developer
 
Posts: 102
Joined: Sat Feb 12, 2011 1:18 pm
Location: Indore

Re: Sendig geolocation via SMS

Postby cogalian » Wed Jun 15, 2011 7:40 am

Thank you for the quick reply, i want to make an app that when i press a button it gets and sends the gps position to a predefined phone number.
cogalian
Developer
Developer
 
Posts: 40
Joined: Mon Jun 13, 2011 5:40 pm

Re: Sendig geolocation via SMS

Postby abhijitphatak28 » Mon Jun 20, 2011 10:10 am

Ok, so basically on Button Click event, you need to start location listerner and when you receive location call back, send those location values through SMS.

If you want i can share code snippet as well.

Thanks

Regards
-Abhijit
User avatar
abhijitphatak28
Senior Developer
Senior Developer
 
Posts: 102
Joined: Sat Feb 12, 2011 1:18 pm
Location: Indore

Re: Sendig geolocation via SMS

Postby cogalian » Mon Jun 20, 2011 4:55 pm

Yes, it's exactly what i need. i am having problems making it, if i could see your code maybe i will find my errors. If i will still get errors can i post the code and get some help from you?
cogalian
Developer
Developer
 
Posts: 40
Joined: Mon Jun 13, 2011 5:40 pm

Re: Sendig geolocation via SMS

Postby cogalian » Tue Jun 21, 2011 7:22 pm

Solved, a friend told me to try to implement a method onRecieve for broadcast and i get error if i dont make my function static, but if i make it static i get error on my phone, my old function was:
Code: Select all
public void showLocation(View view) {
                switch (view.getId()) {
                case R.id.Button01:
                        LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
                        Location location = locationManager
                                        .getLastKnownLocation(LocationManager.GPS_PROVIDER);
                        if (location != null) {
                           
                                double lat = (double) (location.getLatitude());
                                double lng = (double) (location.getLongitude());
                                latituteField.setText(String.valueOf(lat));
                                longitudeField.setText(String.valueOf(lng));
                                String.valueOf(latituteField);
                                String number="3282625137";
                                SmsReactor.sendsms.sendTextMessage(number, null,String.valueOf(lat), null, null);
                          
                        } else {
                                latituteField.setText("GPS not available");
                                longitudeField.setText("GPS not available");
                        }
                        break;
                }

        }

in the new version i just removed the button like so:
Code: Select all
public void showLocation(View view) {
                        LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
                        Location location = locationManager
                                        .getLastKnownLocation(LocationManager.GPS_PROVIDER);
                        if (location != null) {
                           
                                double lat = (double) (location.getLatitude());
                                double lng = (double) (location.getLongitude());
                                latituteField.setText(String.valueOf(lat));
                                longitudeField.setText(String.valueOf(lng));
                                String.valueOf(latituteField);
                                String number="3282625137";
                                SmsReactor.sendsms.sendTextMessage(number, null,String.valueOf(lat), null, null);
                          
                        } else {
                                latituteField.setText("GPS not available");
                                longitudeField.setText("GPS not available");
                        }
         }

i tryed to make an instance of the class but i dont get anything...
how can i solve this?

i found this link but i get an error... http://code.google.com/p/androidsmsphonelocator/source/detail?r=3
the error is on this line of MainSetting.java
addPreferencesFromResource(R.xml.preferences);

error:
xml cannot be resolved or is not a field

solved but i cant make it work anyway....
cogalian
Developer
Developer
 
Posts: 40
Joined: Mon Jun 13, 2011 5:40 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests