Browse Source

VerbesserungV2

master
Raz492 2 years ago
parent
commit
344f6b4514

+ 0
- 36
app/arontestprojekt-default-rtdb-export.json View File

@@ -1,36 +0,0 @@
{
"overview" : {
"IDG1" : {
"amplitude" : 1001,
"breitengrad" : 49.5,
"ip" : "10.00.00.001",
"laengengrad" : 11.5,
"timestamp" : 1113456789,
"vibration" : true
},
"IDG2" : {
"amplitude" : 200,
"breitengrad" : 40.70064147511923,
"ip" : "20.00.00.000",
"laengengrad" : -73.99376799797778,
"timestamp" : 1203456789,
"vibration" : false
},
"IDG3" : {
"amplitude" : 30,
"breitengrad" : -33.93157129193122,
"ip" : "30.00.00.000",
"laengengrad" : 18.39666975233824,
"timestamp" : 1303456789,
"vibration" : false
},
"IDG4" : {
"amplitude" : 4,
"breitengrad" : -33.40763257191139,
"ip" : "40.00.00.000",
"laengengrad" : -70.61870273653996,
"timestamp" : 1403456789,
"vibration" : false
}
}
}

+ 1
- 0
app/build.gradle View File

@@ -36,6 +36,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.firebase:firebase-database:20.0.0'
implementation 'com.google.firebase:firebase-functions:20.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

+ 8
- 66
app/google-services.json View File

@@ -1,92 +1,34 @@
{
"project_info": {
"project_number": "1097743535942",
"firebase_url": "https://arontestprojekt-default-rtdb.europe-west1.firebasedatabase.app",
"project_id": "arontestprojekt",
"storage_bucket": "arontestprojekt.appspot.com"
"project_number": "957720376634",
"firebase_url": "https://schockwelle-mdt5-g1-default-rtdb.europe-west1.firebasedatabase.app",
"project_id": "schockwelle-mdt5-g1",
"storage_bucket": "schockwelle-mdt5-g1.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1097743535942:android:527888c66e66b847d29f47",
"android_client_info": {
"package_name": "com.example.myapplication1fb"
}
},
"oauth_client": [
{
"client_id": "1097743535942-ajbqq8gjc565pj2c2j5qtlskoskevf6o.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCwR1_JUNHQznkwcDjx5mngPJuqktBKFeM"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1097743535942-ajbqq8gjc565pj2c2j5qtlskoskevf6o.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1097743535942:android:fba2ee9540898b84d29f47",
"android_client_info": {
"package_name": "com.example.myapplicationf2"
}
},
"oauth_client": [
{
"client_id": "1097743535942-ajbqq8gjc565pj2c2j5qtlskoskevf6o.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCwR1_JUNHQznkwcDjx5mngPJuqktBKFeM"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1097743535942-ajbqq8gjc565pj2c2j5qtlskoskevf6o.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1097743535942:android:34888690bd5c9564d29f47",
"mobilesdk_app_id": "1:957720376634:android:fdc03f689ff71b2f70cc03",
"android_client_info": {
"package_name": "de.edotzlaff.schockwelle"
}
},
"oauth_client": [
{
"client_id": "1097743535942-ajbqq8gjc565pj2c2j5qtlskoskevf6o.apps.googleusercontent.com",
"client_id": "957720376634-gvj86hvfrnt5npvqfbsb8lnu77fgaumh.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCwR1_JUNHQznkwcDjx5mngPJuqktBKFeM"
"current_key": "AIzaSyDNnG6F_VIzKbu4r7QBqsUZ3z6ELFbgyuc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1097743535942-ajbqq8gjc565pj2c2j5qtlskoskevf6o.apps.googleusercontent.com",
"client_id": "957720376634-gvj86hvfrnt5npvqfbsb8lnu77fgaumh.apps.googleusercontent.com",
"client_type": 3
}
]

+ 9
- 7
app/src/main/java/de/edotzlaff/schockwelle/EarthquakeMapsActivity.java View File

@@ -44,7 +44,8 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea

private DatabaseReference mDatenbank;

Date currentTime;
//Date currentTime; //Workaround für Crash: currentTime nicht als Datum sondern als Long zeitstempel
Long currentTime;
Location currentLocation;

private double breitengrad;
@@ -55,7 +56,7 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_earthquake_maps);

//getDataBaseValues(); //TODO Edward: Nur als Anmerkung, diese Methode erfolgt damit deine Methode getDeviceLocation Koordinaten aus der DB bekommt
getDataBaseValues(); //TODO Edward: Nur als Anmerkung, diese Methode erfolgt damit deine Methode getDeviceLocation rechtzeitig Koordinaten aus der DB bekommt
//TODO Hast schon echt viel erledigt :D Ich habe gedacht das die Class EarthquakeMapsActivity Daten an die DB schickt und die SensorMapsActivity die Daten bekommt, ich glaub die Funktion muss in die andere Class
getLocationPermission();
}
@@ -127,11 +128,12 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()){
currentLocation = (Location) task.getResult();
currentTime = Calendar.getInstance().getTime();
//currentTime = Calendar.getInstance().getTime(); //Workaround für Crash: currentTime nicht als Datum sondern als Long zeitstempel
currentTime = Calendar.getInstance().getTimeInMillis();
Toast.makeText(EarthquakeMapsActivity.this, currentTime.toString(), Toast.LENGTH_SHORT).show();
//currentLocation.setLatitude(breitengrad); //Hier werden beispielweise Koordinaten aus der Datenbank verwendet für Gerät IDG1
//currentLocation.setLongitude(laengengrad); //Hier werden beispielweise Koordinaten aus der Datenbank verwendet für Gerät IDG1
//setDataBaseValues(); //TODO Aron: Sobald ich die Funktion aufrufen will crashed die APP
currentLocation.setLatitude(breitengrad);
currentLocation.setLongitude(laengengrad);
setDataBaseValues(); //TODO Edward: Die Funktion geht jetzt. Statt Datum wird Unix Zeitstempel als Long Typ verwendet
moveCamera(new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()),15f);
}
else{
@@ -189,7 +191,7 @@ public class EarthquakeMapsActivity extends FragmentActivity implements OnMapRea
mDatenbank = FirebaseDatabase.getInstance().getReference();
mDatenbank.child("overview").child("IDG1").child("ip").setValue("10.00.00.001");
mDatenbank.child("overview").child("IDG1").child("vibration").setValue(true);
mDatenbank.child("overview").child("IDG1").child("timestamp").setValue(currentTime.toString()); //aktueller Zeitstempel wird in Datenbank eingetragen
mDatenbank.child("overview").child("IDG1").child("timestamp").setValue(currentTime); //aktueller Zeitstempel wird in Datenbank eingetragen
mDatenbank.child("overview").child("IDG1").child("breitengrad").setValue(currentLocation.getLatitude()); //aktueller Breitengrad
mDatenbank.child("overview").child("IDG1").child("laengengrad").setValue(currentLocation.getLongitude()); //aktueller Längergrad
mDatenbank.child("overview").child("IDG1").child("amplitude").setValue(1001);

+ 5
- 5
app/src/main/java/de/edotzlaff/schockwelle/MainActivity.java View File

@@ -84,10 +84,10 @@ public class MainActivity extends FragmentActivity {
public void deviceInitDataBase()
{
mDatenbank = FirebaseDatabase.getInstance().getReference();
Devices d1 = new Devices("10.00.00.000", false, 1103456789, 49.45470362290784, 11.151032510281498, 1000);
Devices d2 = new Devices("20.00.00.000", false, 1203456789, 40.70064147511923, -73.993767997977787, 200);
Devices d3 = new Devices("30.00.00.000", false, 1303456789, -33.93157129193122, 18.39666975233824, 30);
Devices d4 = new Devices("40.00.00.000", false, 1403456789, -33.40763257191139, -70.61870273653996, 4);
Devices d1 = new Devices("10.00.00.000", false, 1623926431100L, 49.45470362290784, 11.151032510281498, 1000);
Devices d2 = new Devices("20.00.00.000", false, 1623926431200L, 40.70064147511923, -73.993767997977787, 200);
Devices d3 = new Devices("30.00.00.000", false, 1623926431300L, -33.93157129193122, 18.39666975233824, 30);
Devices d4 = new Devices("40.00.00.000", false, 1623926431400L, -33.40763257191139, -70.61870273653996, 4);
mDatenbank.child("overview").child("IDG1").setValue(d1);
mDatenbank.child("overview").child("IDG2").setValue(d2);
mDatenbank.child("overview").child("IDG3").setValue(d3);
@@ -100,7 +100,7 @@ public class MainActivity extends FragmentActivity {
mDatenbank.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
processDataBaseValues(snapshot); //Daten - Snapshot, Übergabe an Methode DataChangeProtocol
processDataBaseValues(snapshot); //Daten - Snapshot, Übergabe an Methode processDataBaseValues
}
@Override
public void onCancelled(@NonNull DatabaseError error) {

+ 2
- 3
app/src/main/java/de/edotzlaff/schockwelle/SensorMapsActivity.java View File

@@ -61,7 +61,7 @@ public class SensorMapsActivity extends FragmentActivity implements OnMapReadyCa

getLocationPermission(); //Zuerst werden die aktuellen Standortdaten ermittelt

//getDataBaseValues(); // Hier werden die Daten von der DB abgefragt //TODO Aron: sobald die Methode aufgerufen wird crashed die APP
getDataBaseValues(); // Hier werden die Daten von der DB abgefragt //TODO Edward: Geht wieder :D

//distance(currentLocation.getLatitude(), currentLocation.getLongitude(),breitengrad,laengengrad); //Übergabe zur Berechnung der Distanz zwischen Auslöser und aktuellem Standort

@@ -164,7 +164,7 @@ public class SensorMapsActivity extends FragmentActivity implements OnMapReadyCa
mDatenbank.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
processDataBaseValues(snapshot); //Daten - Snapshot, Übergabe an Methode DataChangeProtocol
processDataBaseValues(snapshot);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
@@ -231,5 +231,4 @@ public class SensorMapsActivity extends FragmentActivity implements OnMapReadyCa

return distanceInMeters;
}

}

+ 2
- 2
gradle/wrapper/gradle-wrapper.properties View File

@@ -1,6 +1,6 @@
#Mon Jun 14 19:58:23 CEST 2021
#Thu Jun 17 12:39:35 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

Loading…
Cancel
Save