My share of php I believe is working. I do not know how to get this data for Android. How can I do? I need to pass the data name, message, lat, long to some variable in android.
Part of Php:
$sql = $dbcon->query("SELECT * FROM mensagem
INNER JOIN usuarios ON mensagem.idUsuarios = usuarios.idUsuarios
");
foreach ($sql as $value) {
//$sql = $value['mensagem'];
echo $value['nome'];
echo "<br>";
echo $value['mensagem'];
echo "<br>";
echo $value['lat'];
echo "<br>";
echo $value['long'];
echo "<br>";
}
?>
Share on Android:
package mundosenai.mundosenai.com.mundosenai;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
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;
import android.content.Intent;
import android.widget.Button;
public class MapsFragment extends SupportMapFragment implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getMapAsync(this);
}
double lat;
double longi;
String mensagem;
String nome;
@Override
public void onMapReady(GoogleMap map) {
LatLng MinhaLocalizacao = new LatLng(lat, longi);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(MinhaLocalizacao, 3));
}
}