---------UPDATE -----------------------------------------
When the app starts I receive numberformat exception at line :
final long thetime=Long.par
because I made lonfitude and latitude Strings (I had them as double before). How can I overcome that?
To get String from double use String.valueOf();
String latitude = String.valueOf(location.getLatitude());
Repeat
Also,how can I select to send the data in time intervals that the user will define?
To repeat at specific interval use AlarmManager.