I collect signal data and load it into a database.
I have several functions and several test functions have been done before trying to implement the rest. It crashes when loading with classes that I want to use, but not with test cases.
Here is the code for class methods and initializations:
Initialize database
FirebaseDatabase database;
DatabaseReference myRef;
classes:
package com.example.mike.maps_example;
public class WcdmaSignalEntry {
Double Latitude, Longitude;
String dBm;
String Cid;
String Lac;
String Mcc;
String Mnc;
String Psc;
String Uarfcn;
String connectionType = "WCDMA";
public WcdmaSignalEntry(){
}
public WcdmaSignalEntry(double Latitude, double Longitude, String dBm, String Cid, String Lac, String Mcc, String Mnc, String Psc, String Uarfcn){
this.Latitude = Latitude;
this.Longitude = Longitude;
this.dBm = dBm;
this.Cid = Cid;
this.Lac = Lac;
this.Mcc = Mcc;
this.Mnc = Mnc;
this.Psc = Psc;
this.Uarfcn = Uarfcn;
}
}
Here is the code for the testing class:
package com.example.mike.maps_example;
public class CellSignalEntry {
public double Latitude;
public double Longitude;
public String dBm;
public String CI;
public String LAC;
public String PSC;
public String TA;
public String PCI_LTE;
public String PCI_GSM;
public CellSignalEntry() {
}
public CellSignalEntry(String dBm, String CI, String LAC, String PSC, String TA, String PCI_LTE, String PCI_GSM, double Latitude, double Longitude) {
this.dBm = dBm;
this.CI = CI;
this.LAC = LAC;
this.PSC = PSC;
this.TA = TA;
this.PCI_GSM = PCI_GSM;
this.PCI_LTE = PCI_LTE;
this.Latitude = Latitude;
this.Longitude = Longitude;
}
}
I have two methods.
private void writeNewWcdmaEntry(double lon, double lat, String dBm, String Cid, String Lac, String Mcc, String Mnc,String Psc, String Uarfcn, long entry){
WcdmaSignalEntry newEntry = new WcdmaSignalEntry(lon, lat, dBm, Cid, Lac, Mcc, Mnc, Psc, Uarfcn);
tvView.setText(newEntry.dBm);
tvView.setText(newEntry.Cid);
}
and
private void writeNewUser(long userId, String dBm, String CI, String LAC, String PSC, String TA, String PCI_LTE, String PCI_GSM, double currentLat, double currentLon) {
CellSignalEntry user = new CellSignalEntry(dBm, CI, LAC, PSC, TA, PCI_LTE, PCI_GSM, currentLat, currentLon);
myRef.child("Entry").child(Long.toString(userId)).setValue(user);
}
My application works fine when I run the second method, but when I run the first method, it crashes when the data is loaded into the firebase database, if I uncomment this line:
//myRef.child("Entry").child(Long.toString(entry)).setValue(newEntry);
I am completely at a dead end. Any help is appreciated.
EDIT: . , , "public" WcdmaSignalEntry , , , java, :)!