Browse Source

CrashFix

master
Aron Abdulajev 3 years ago
parent
commit
0809d06f3f

+ 10
- 1
app/src/main/java/de/edotzlaff/schockwelle/EarthquakeMapsActivity.java View File

@@ -21,6 +21,7 @@ import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
@@ -42,6 +43,7 @@ import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
@@ -142,6 +144,7 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea
}
}
@RequiresApi(api = Build.VERSION_CODES.O)
public void onFinish() {
if (Math.abs(mAccel) > mUpperThreshold) {
mShakeDetectionIsActive = false;
@@ -163,6 +166,7 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea
}
};
@RequiresApi(api = Build.VERSION_CODES.O)
private void writeEarthquakeToDatabase()
{
setDataBaseValues();
@@ -198,7 +202,6 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
mLocationPermissionsGranted = false;
switch (requestCode) {
case LOCATION_PERMISSION_REQUEST_CODE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
@@ -364,13 +367,19 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea
return ipAddress;
}
@RequiresApi(api = Build.VERSION_CODES.O)
public void setDataBaseValues()
{
mDatenbank = FirebaseDatabase.getInstance().getReference();
mDatenbank.child("overviewnodes").child("IDG" + indexID).child("a_androidid").setValue(getandroidid());
/*
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mDatenbank.child("overviewnodes").child("IDG" + indexID).child("b_localdatetime").setValue(LocalDateTime.now().toString());
}
*/
mDatenbank.child("overviewnodes").child("IDG" + indexID).child("b_localdatetime").setValue(LocalDateTime.now(ZoneOffset.UTC).toString());
mDatenbank.child("overviewnodes").child("IDG" + indexID).child("c_ip").setValue(getDeviceIpAdress());
mDatenbank.child("overviewnodes").child("IDG" + indexID).child("d_breitengrad").setValue(breitengrad);
mDatenbank.child("overviewnodes").child("IDG" + indexID).child("e_laengengrad").setValue(laengengrad);

Loading…
Cancel
Save