Android firestore update or set method make an app restart - java

Hi I'm using FireStore to store data in remote database. However, I had a problem with using set and update method.
When I want to update some value in some documents and display dialog after update, my android app restarts. The below is logcat which is displayed when I proceed above process.
12-27 12:09:49.838 17014-17014/com.wecobell.www.doggy D/showUnlockDialog: OnSuccess
12-27 12:09:49.875 17014-17014/com.wecobell.www.doggy W/OpenGLRenderer: Points are too far apart 4.000001
12-27 12:09:49.908 17014-17014/com.wecobell.www.doggy D/MainActivity: onPause
12-27 12:09:49.930 17014-17014/com.wecobell.www.doggy D/MainActivity: ---- Network Status Check ----
12-27 12:09:49.932 17014-17014/com.wecobell.www.doggy D/MainActivity: Wifi Connection : true, 4G or 5G : false
12-27 12:09:49.943 17014-17014/com.wecobell.www.doggy D/MainActivity: onCreate
As you can see, MainActivity is reopened, when 'showUnlockDialog' is successfully displayed. How can I solve this problem?
/**
* 메소드명 : unlockProfile
* 설명 : Method that unlocks user's profile
*/
private void unlockProfile(final int position) {
FirebaseFirestore firestore = FirebaseFirestore.getInstance();
FirebaseAuth auth = FirebaseAuth.getInstance();
FirebaseUser user = auth.getCurrentUser();
String currentUid = user.getUid();
FireStore.unlockInterestedUser(firestore, currentUid, interestedUsers.get(position).getUid());
}
/**
* 메소드명 : showUnlockDialog
* 설명 : Method that displays dialog.
*/
private void showUnlockDialog(final int position) {
MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
builder.content("프로필을 보시려면 뼈다귀 포인트 5개가 필요합니다.")
.positiveText("적용")
.onPositive(new MaterialDialog.SingleButtonCallback() {
#Override
public void onClick(#NonNull MaterialDialog dialog, #NonNull DialogAction which) {
FirebaseFirestore firestore = FirebaseFirestore.getInstance();
DocumentReference dc = FireStore.getPointOfUser(firestore, MyUser.getInstance().getUid());
FirebaseAuth fa = FirebaseAuth.getInstance();
FirebaseUser user = fa.getCurrentUser();
final DocumentReference me = FireStore.getUserInfo(firestore, user.getUid());
me.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
#Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
Log.d("showUnlockDialog", "OnSuccess");
MyUser user = documentSnapshot.toObject(MyUser.class);
int newPoint = user.getPoint() - 5;
user.setPoint(newPoint);
me.set(user).addOnSuccessListener(new OnSuccessListener<Void>() {
#Override
public void onSuccess(Void aVoid) {
Log.d("showUnlockDialog", "unlockProfileMethod");
unlockProfile(position);
Toast.makeText(context, "업데이트 완료", Toast.LENGTH_SHORT).show();
}
});
}
});
}
})
.negativeText("취소")
.show();
}

Related

How can I get an order id from Firestore and pass it to my adaptor class?

I need to get an order id from Firestore and pass that id to my Query but I'm getting the order id happens asynchronously. So I am forced to initialize my adaptor inside the Firebase callback method. The issue is that my onStart and onStop methods are listening on the adaptor and then throws a NullPointException.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_to_cart);
// Navigate to men section
fromAddToCartToForHim = findViewById(R.id.fromAddToCartToForHim);
fromAddToCartToForHim.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(AddToCart.this, HimActivity.class);
startActivity(intent);
finish();
}
});
//Navigate to Women section
fromAddToCartToForHer = findViewById(R.id.fromAddToCartToForHer);
fromAddToCartToForHer.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(AddToCart.this, WomenActivity.class);
startActivity(intent);
finish();
}
});
// Navigate to Household section
fromAddToCartToForHouseHold = findViewById(R.id.fromAddToCartToForHouseHold);
fromAddToCartToForHouseHold.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(AddToCart.this, HouseHoldActivity.class);
startActivity(intent);
finish();
}
});
// SetUpRecyclerView func
setUpRecycleView();
}
private void setUpRecycleView() {
// GET CURRENT ORDER ID
orderRef.get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
#Override
public void onComplete(#NonNull #NotNull Task<QuerySnapshot> task) {
if (task.isComplete()) {
QuerySnapshot snapshot = task.getResult();
assert snapshot != null;
for (DocumentSnapshot snapshots : snapshot.getDocuments()) {
String user_id = snapshots.getString("user_id");
Boolean status = snapshots.getBoolean("status");
if (user_id.equals(getUserId()) && !status) {
// User has existing Order
// Check if order is pending or completed
String orderId = snapshots.getId();
Query query = orderRef
.document(orderId)
.collection("orderlist")
.orderBy("category").orderBy("priority", Query.Direction.ASCENDING);
FirestoreRecyclerOptions<OrderList> options = new FirestoreRecyclerOptions.Builder<OrderList>()
.setQuery(query, OrderList.class)
.build();
addToCartAdaptor = new AddToCartAdaptor(options);
recyclerView = findViewById(R.id.recyclerviewAddToCart);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(AddToCart.this));
recyclerView.setAdapter(addToCartAdaptor);
}
}
}
}
});
}
enter code here
#Override
protected void onStart() {
super.onStart();
addToCartAdaptor.startListening(); Error happens here
}
#Override
protected void onStop() { `enter code here`
super.onStop();
addToCartAdaptor.stopListening();
}
HERE IS THE ERROR I GET
W/example.neptun: Accessing hidden method Lcom/msic/qarth/PatchStore;->createDisableExceptionQarthFile(Ljava/lang/Throwable;)Z (blacklist, JNI)
E/example.neptun: [qarth_debug:] get PatchStore::createDisableExceptionQarthFile method fail.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.neptune, PID: 2884
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.example.neptune.Adapters.AddToCartAdaptor.startListening()' on a null object reference
at com.example.neptune.AddToCart.onStart(AddToCart.java:150)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1419)
at android.app.Activity.performStart(Activity.java:7479)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3454)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
at android.os.Handler.dispatchMessage(Handler.java:112)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I/Process: Sending signal. PID: 2884 SIG: 9
When you are using the following line of code:
addToCartAdaptor = new AddToCartAdaptor(options);
Inside the "onComplete()" method, it means it will always run right after the onStart, as it takes some time to get the data from the orderRef reference. What you can do, is to create the (default) Query, FirestoreRecyclerOptions, and AddToCartAdaptor objects outside the onComplete() method, and once you get the data inside the callback, simply update the "options" object, with the data that you get from the database. In this way, you provide the data to the "options" object, only when it is available.
This also means that you'll never get a NullPointerException anymore because the addToCartAdaptor is already initialized.

How do you pass values from an activity to a class in Android Studio?

I am trying to set up a delete button to delete a customer from a table. The customers are displayed in card views using a recycler view so each customer will have their own delete button. The customer information is displayed using text views. I need to pass the customer id to the delete method in order to search the table for that specific id to delete. How do I pass the data successfully?
This is what I've currently got to try and pass the data I need
public void onBindViewHolder(#NonNull MyHolder holder, final int position) {
holder.idText.setText(String.valueOf(id.get(position)));
holder.nameText.setText(String.valueOf(name.get(position)));
holder.surnameText.setText(String.valueOf(surname.get(position)));
holder.add1Text.setText(String.valueOf(add1.get(position)));
holder.add2Text.setText(String.valueOf(add2.get(position)));
holder.add3Text.setText(String.valueOf(add3.get(position)));
holder.postCodeText.setText(String.valueOf(postCode.get(position)));
holder.phoneNumberText.setText(String.valueOf(phoneNumber.get(position)));
holder.emailText.setText(String.valueOf(email.get(position)));
GlobalVars.id = holder.idText.getText().toString();
holder.delete.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
db.deleteCustomer(GlobalVars.id);
}
});
}
This is my delete method:
public long deleteCustomer(String id)
{
SQLiteDatabase db = this.getWriteableDatabase();
ContentValues idValue = new ContentValues();
idValue.put(CUSTOMER_ID, id);
return db.delete(TABLE_NAME, "where Customer_ID = " + idValue, null);
}
When I run the app, it displays the customers and the buttons, but when I click any of the buttons I get a blank screen. And then it returns to the login screen I have.
These are the errors that show up in LogCat:
2021-05-01 12:16:26.212 18729-18729/com.example.rowlandsflooringapp E/Zygote: isWhitelistProcess - Process is Whitelisted
2021-05-01 12:16:26.212 18729-18729/com.example.rowlandsflooringapp E/Zygote: accessInfo : 1
2021-05-01 12:16:26.244 18729-18729/com.example.rowlandsflooringapp E/andsflooringap: Unknown bits set in runtime_flags: 0x8000
2021-05-01 12:16:55.186 18729-18729/com.example.rowlandsflooringapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rowlandsflooringapp, PID: 18729
java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.File android.content.Context.getDatabasePath(java.lang.String)' on a null object reference
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:445)
at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:415)
at com.example.rowlandsflooringapp.CustomerDB.deleteCustomer(CustomerDB.java:70)
at com.example.rowlandsflooringapp.CustomerAdapter$1.onClick(CustomerAdapter.java:73)
at android.view.View.performClick(View.java:7862)
at android.widget.TextView.performClick(TextView.java:15004)
at android.view.View.performClickInternal(View.java:7831)
at android.view.View.access$3600(View.java:879)
at android.view.View$PerformClick.run(View.java:29359)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
After several attempts of trying and it failing, I decided to create the delete method from scratch again. This is what I ended up with and it works great.
A delete method inside the databasehelper:
void deleteOneRow(String row_id){
SQLiteDatabase db = this.getWritableDatabase();
long result = db.delete(TABLE_NAME, "_id=?", new String[]{row_id});
if(result == -1){
Toast.makeText(context, "Failed to Delete.", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(context, "Successfully Deleted.", Toast.LENGTH_SHORT).show();
}
Calling the delete method:
void confirmDialog(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Delete " + name + " ?");
builder.setMessage("Are you sure you want to delete " + name + " ?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialogInterface, int i) {
MyDatabaseHelper myDB = new MyDatabaseHelper(UpdateActivity.this);
myDB.deleteOneRow(id);
finish();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.create().show();
}
}

how we can pass uid of current user login from adapter to other activity

how we can pass uid of current user login from adapter to other activity I am already passing the clicked item id from adapter to other activity that easy because I already print this id but I am confused about how to pass the uid of current user login please guide
//I have retrieve data in main activity of current user
private void loadmyinfo() {
DatabaseReference ref= FirebaseDatabase.getInstance().getReference("Users");
ref .orderByChild("uid").equalTo(firebaseAuth.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot snapshot) {
for(DataSnapshot ds:snapshot.getChildren())
{
String Nam=""+ds.child("name").getValue();
// String accounttype=""+ds.child("account type").getValue();
String Profile=""+ds.child("profileuser").getValue();
String Email=""+ds.child("email").getValue();
String cphone=""+ds.child("phone").getValue();
nametx.setText(Nam);
cphon.setText(cphone);
nameemail.setText(Email);
try {
/* Glide.with(ProfileeditsellerActivity.this)
.load(Profile)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.into(profile);*/
Picasso.get().load(Profile).placeholder(R.drawable.ic_profile_gray).into(profile);
}
catch (Exception e){
profile.setImageResource(R.drawable.ic_profile_gray);
}
}
}
#Override
public void onCancelled(#NonNull DatabaseError error) {
}
});
adapter class
//In adapter class I have passed the id of clicked item but I want also to pass uid of current user
holder.itemView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
/* Intent intent=new Intent(context,BilActivity.class);
intent.putExtra("id",id);
context.startActivity(intent);*/
Intent intent=new Intent(holder.itemView.getContext(),PayfeeActivity.class);
intent.putExtra("id",id);
holder.itemView.getContext().startActivity(intent);
}
});
you can get the current logged in firebase user from anywhere in your app using
FirebaseAuth.getInstance().getCurrentUser().getUid();
if what you want is passing the current user id you can use #huda Olayan 's answer but if you want a uid from a position in a list then you can use a localBroadcast to do so you will need to create an intent and pass the string in the intent like so:
Intent intent = new Intent("key-for-finding-broadcast");
intent.putExtra("uid", "uid");
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
next you have to catch the broadcast and register the broadcastReciever and pass the intentFilter as the name "key-for-finding-broadcast". So you make a new BroadcastReceiver like so:
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
//to find the uid when its recieved you do the following
String uid = intent.getStringExtra("uid");
}
};
then you have to register so you can put this line in your onCreate Method:
LocalBroadcastManager.getInstance(context).registerReceiver(broadcastReciever, new IntentFilter("key-for-finding-broadcast"));

Why is my onActivityResult() always returning false?

I'm trying to set up google sign in for my app but it keeps failing, I click on a button, get a popup, select account and a Toast pops up telling me that sign in failed. Any ways I can fix this? The problem lies in onActivityResult() method and the said Toast says "Auth went wrong". I've searched all over the internet but failed to find a solution or even a reason why this is happening. Line 80 is this
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
public class SignInActivity extends AppCompatActivity {
static final int GOOGLE_SIGN_IN = 2;
FirebaseAuth mAuth;
Button btn_login;
GoogleSignInClient mGoogleSignInClient;
FirebaseAuth.AuthStateListener mAuthListener;
#Override
protected void onStart() {
super.onStart();
mAuth.addAuthStateListener(mAuthListener);
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
btn_login = findViewById(R.id.login);
mAuth = FirebaseAuth.getInstance();
mAuthListener = new FirebaseAuth.AuthStateListener() {
#Override
public void onAuthStateChanged(#NonNull FirebaseAuth firebaseAuth) {
if (firebaseAuth.getCurrentUser() != null) {
Switch();
}
}
};
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
btn_login.setOnClickListener(v -> signIn());
}
private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
startActivityForResult(signInIntent, GOOGLE_SIGN_IN);
}
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == GOOGLE_SIGN_IN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
// Google Sign In failed, update UI appropriately
Log.w("TAG", "Google sign in failed", e);
Toast.makeText(SignInActivity.this, "Auth went wrong :/", Toast.LENGTH_SHORT).show();
// ...
}
}
}
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d("TAG", "firebaseAuthWithGoogle:" + acct.getId());
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d("TAG", "signInWithCredential:success");
FirebaseUser user = mAuth.getCurrentUser();
Toast.makeText(SignInActivity.this, "Success!", Toast.LENGTH_SHORT).show();
updateUI(user);
Switch();
} else {
// If sign in fails, display a message to the user.
Log.w("TAG", "signInWithCredential:failure", task.getException());
Toast.makeText(SignInActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show();
updateUI(null);
}
});
}
}
2019-03-23 12:13:35.569 6312-6312/com.charpik.agropomocnik W/TAG: Google sign in failed
com.google.android.gms.common.api.ApiException: 10:
at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source:4)
at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source:8)
at com.charpik.agropomocnik.SignInActivity.onActivityResult(SignInActivity.java:80)
at android.app.Activity.dispatchActivityResult(Activity.java:7701)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5037)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5084)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
at android.os.Handler.dispatchMessage(Handler.java:108)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
I fixed the similar issue by using the latest version of the appcompat library.
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
If it's not the case, try without requestIdToken(getString(R.string.default_web_client_id)). And if the error is not occurred, you should check the credential part again.
Check these:
Is SHA-1 fingerprint correct?
Is SHA-1 fingerprint for debug or release?
Is package name correct?
Did you use the web application type client ID?

java.lang.StackOverflowError: stack size 8MB FirebaseAuth

I am creating Login with Facebook from Firebase. I am using Facebook Sdk and AccountKit with Firebase Auth. I worked with Firebase Auth on dozens of projects before everything used to run smoothly. This time I am working with AccountKit too.
This is my traditional code to login with facebook and retrieving the access token.
mAuth = FirebaseAuth.getInstance();
mAuthListener = new FirebaseAuth.AuthStateListener() {
#Override
public void onAuthStateChanged(#NonNull FirebaseAuth firebaseAuth) {
firebaseAuth.getCurrentUser();
}
};
mCallbackManager = CallbackManager.Factory.create();
facebookLogin.setReadPermissions("email", "public_profile", "user_birthday");
facebookLogin.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
#Override
public void onSuccess(LoginResult loginResult) {
Log.d(TAG, "facebook:onSuccess:" + loginResult);
handleFacebookAccessToken(loginResult.getAccessToken());
Profile profile = Profile.getCurrentProfile();
if (profile != null) {
userId = profile.getId();
}
}
#Override
public void onCancel() {
updateUI(null);
}
#Override
public void onError(FacebookException error) {
updateUI(null);
}
});
The ActivityResult Code now has both AccountKit Code and Facebook CallbackManager
#Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mCallbackManager.onActivityResult(requestCode, resultCode, data);
// confirm that this response matches your request
if (requestCode == APP_REQUEST_CODE) {
AccountKitLoginResult loginResult = data.getParcelableExtra(AccountKitLoginResult.RESULT_KEY);
if (loginResult.getError() != null) {
// display login error
String toastMessage = loginResult.getError().getErrorType().getMessage();
Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show();
} else if (loginResult.getAccessToken() != null) {
// on successful login, proceed to the account activity
launchAccountActivity();
}
}
}
The problem is here where the App Crashes on this method while handling the AccessToken.
private void handleFacebookAccessToken(final AccessToken token) {
Log.d(TAG, "handleFacebookAccessToken:" + token);
showProgressDialog();
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
mAuth.signInWithCredential(credential).addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
#Override
public void onSuccess(AuthResult authResult) {
updateUI(authResult.getUser());
}
});
}
private void updateUI(final FirebaseUser firebaseUser){
if (firebaseUser != null) {
Map<String, Object> updateValues = new HashMap<>();
Profile profile = Profile.getCurrentProfile();
if (profile != null) {
userId = profile.getId();
}
updateValues.put("userName", firebaseUser.getDisplayName() != null ? firebaseUser.getDisplayName() : "Anonymous");
updateValues.put("photo", firebaseUser.getPhotoUrl() != null ? firebaseUser.getPhotoUrl() : null);
updateValues.put("userId", firebaseUser.getUid());
updateValues.put("facebookId", userId != null ? userId : null);
FirebaseUtil.getCustomersRef().child(firebaseUser.getUid()).updateChildren(
updateValues,
new DatabaseReference.CompletionListener() {
#Override
public void onComplete(DatabaseError firebaseError, DatabaseReference databaseReference) {
if (firebaseError == null) {
doPhoneLogin();
}
}
});
}
}
Here is my Logcat for the Crash
08-09 14:07:02.571 9962-14870/in.order.craveu D/FA: Connected to remote service
08-09 14:07:02.571 9962-14870/in.order.craveu V/FA: Processing queued up service tasks: 4
08-09 14:07:05.668 9962-10097/in.order.craveu D/FirebaseAuth: Notifying id token listeners about user ( 5mSc7SjIltWWWHWzUJ3AoxkobEW2 ).
08-09 14:07:05.685 9962-9962/in.order.craveu D/FirebaseApp: Notifying auth state listeners.
08-09 14:07:05.685 9962-9962/in.order.craveu D/FirebaseApp: Notified 0 auth state listeners.
08-09 14:07:05.756 9962-9962/in.order.craveu I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:6
08-09 14:07:05.756 9962-9962/in.order.craveu I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 6
08-09 14:07:06.369 9962-9972/in.order.craveu I/art: Background partial concurrent mark sweep GC freed 46716(1878KB) AllocSpace objects, 7(136KB) LOS objects, 39% free, 12MB/20MB, paused 5.432ms total 64.680ms
08-09 14:07:06.435 9962-9962/in.order.craveu D/AndroidRuntime: Shutting down VM
08-09 14:07:06.569 9962-9962/in.order.craveu E/UncaughtException: java.lang.StackOverflowError: stack size 8MB
at com.google.android.gms.internal.zg.zzao(Unknown Source)
at com.google.android.gms.internal.zg.zzar(Unknown Source)
at com.google.android.gms.internal.zh.zzas(Unknown Source)
at com.google.android.gms.internal.zg.zzao(Unknown Source)
at com.google.android.gms.internal.zg.zzar(Unknown Source)
After the crash when I open the application I am logged in with Facebook.

Categories