Modificaciones varias
This commit is contained in:
@@ -103,8 +103,24 @@ public class MainActivity extends AppCompatActivity {
|
||||
StrictMode.setThreadPolicy(policy);
|
||||
}
|
||||
|
||||
//TODO: Generar fichero con los puntos de trayectoria
|
||||
|
||||
//Codigo para enviar ubicacion cada 5 segundos
|
||||
// try {
|
||||
// while (true) {
|
||||
// String url = "https://www.google.com/maps/search/?api=1&query="+Double.toString(latitude)+","+Double.toString(longitude);
|
||||
// sendMessage.sendMessage(Double.toString(longitude), Double.toString(latitude), url);
|
||||
// Thread.sleep(5 * 1000);
|
||||
// }
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
|
||||
//Transferimos latitud, longitud y url de maps al sistema
|
||||
String url = "https://www.google.com/maps/search/?api=1&query="+Double.toString(latitude)+","+Double.toString(longitude);
|
||||
sendMessage.sendMessage(Double.toString(longitude), Double.toString(latitude), url);
|
||||
|
||||
sendMessage.sendMessage(Double.toString(latitude), Double.toString(longitude));
|
||||
Iterator it = listadoCoordenadas.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry)it.next();
|
||||
|
||||
@@ -5,15 +5,15 @@ import java.util.Map;
|
||||
|
||||
public class SendMessage {
|
||||
|
||||
public void sendMessage(String longitude, String latitude) {
|
||||
public void sendMessage(String longitude, String latitude, String url) {
|
||||
try {
|
||||
// Headers
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36");
|
||||
HttpPostForm httpPostForm = new HttpPostForm("https://msg.redp.icu/message?token=A9K-dBtytwSmJ-b", "utf-8", headers);
|
||||
HttpPostForm httpPostForm = new HttpPostForm("https://msg.redp.icu/message?token=AMnezCx8jGxCZUr", "utf-8", headers);
|
||||
// Add form field
|
||||
httpPostForm.addFormField("title", "Control");
|
||||
httpPostForm.addFormField("message", "longitud: " +longitude+" . Latitud: "+latitude);
|
||||
httpPostForm.addFormField("title", "Información de ubicación");
|
||||
httpPostForm.addFormField("message", "Longitud: " +longitude+" . Latitud: "+latitude+". ||| URL MAPS: "+url);
|
||||
httpPostForm.addFormField("priority", "5");
|
||||
// Result
|
||||
String response = httpPostForm.finish();
|
||||
|
||||
Reference in New Issue
Block a user