Click here to Skip to main content
15,434,918 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi android enthusiast,

I hope the lockdown is not taking it's on you all, we will surely survive this pandemic

I implemented firenase email/password authemtication in my app which is working well until I migrated my app androidx during test
on clicking on the login button the app crashes and shows the following error message in the logcat

java.lang.IllegalStateException: Not allowed to start service Intent {$EmptyService }: app is in background uid UidRecord{dceaaa5 u0a102 CEM idle change:cached procs:1 seq(0,0,0)}
at android.content.ContextWrapper.startService(
at exo.c(PG:111)
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)

See below the ObClickListener for the login button

private void loginBronze() {
        //We get the email and password from the text boxes
        final String email = bronzeEmail.getText().toString().trim();
        String password = bronzePassword.getText().toString().trim();

        //We verify that the text boxes are not empty
        if (TextUtils.isEmpty(email)) {//(precio.equals(""))
            Toast.makeText(this, "You must enter an email", Toast.LENGTH_LONG).show();

        if (TextUtils.isEmpty(password)) {
            Toast.makeText(this, "Password is missing", Toast.LENGTH_LONG).show();

        progressDialog.setMessage("Performing online consultation ...");;

        //loguear usuario
        firebaseAuth.signInWithEmailAndPassword(email, password)
                .addOnCompleteListener((Executor) this, new OnCompleteListener<AuthResult>() {
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        //checking if success
                        if (task.isSuccessful()) {
                            int pos = email.indexOf("@");
                            String user = email.substring(0, pos);
                            Toast.makeText(BronzeActivationPage.this, "Bienvenido: " + bronzeEmail.getText(), Toast.LENGTH_LONG).show();
                            Intent intencion = new Intent(getApplication(), BronzePackageHome.class);
                            intencion.putExtra(BronzePackageHome.user, user);

                        } else {
                            if (task.getException() instanceof FirebaseAuthUserCollisionException) {//si se presenta una colisión
                                Toast.makeText(BronzeActivationPage.this, "That user already exists ", Toast.LENGTH_SHORT).show();
                            } else {
                                Toast.makeText(BronzeActivationPage.this, "Could not login ", Toast.LENGTH_LONG).show();


When i google for the solution i came across the below url on stackoverflow but i don't really understand how to implement the
solution in my code

Kindly help

What I have tried:

When i google for the solution i came across the below url on stackoverflow but i don't really understand how to implement the
solution in my code
Updated 23-Jul-20 23:34pm

1 solution

What is this
.addOnCompleteListener((Executor) this, new OnCompleteListener<AuthResult>()

I have a sneaky suspision it has to do with the bold parameter in your OnCompleteListener.

Also, have a look at your gradle build file for the app. Roll your Firebase back one version and see if you can duplicate the error.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900