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 { cmp=com.google.android.apps.messaging/.shared.datamodel.action.execution.ActionExecutorImpl$EmptyService }: app is in background uid UidRecord{dceaaa5 u0a102 CEM idle change:cached procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
at android.app.ContextImpl.startService(ContextImpl.java:1532)
at android.content.ContextWrapper.startService(ContextWrapper.java:664)
at com.google.android.apps.messaging.shared.datamodel.action.execution.ActionExecutorImpl.a(PG:97)
at com.google.android.apps.messaging.shared.datamodel.action.execution.ActionExecutorImpl.a(PG:91)
at exo.c(PG:111)
at exl.run(PG:1)
at uev.run(PG:3)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6852)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:504)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
See below the ObClickListener for the login button
private void loginBronze() {
final String email = bronzeEmail.getText().toString().trim();
String password = bronzePassword.getText().toString().trim();
if (TextUtils.isEmpty(email)) {
Toast.makeText(this, "You must enter an email", Toast.LENGTH_LONG).show();
return;
}
if (TextUtils.isEmpty(password)) {
Toast.makeText(this, "Password is missing", Toast.LENGTH_LONG).show();
return;
}
progressDialog.setMessage("Performing online consultation ...");
progressDialog.show();
firebaseAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener((Executor) this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
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);
startActivity(intencion);
} else {
if (task.getException() instanceof FirebaseAuthUserCollisionException) {
Toast.makeText(BronzeActivationPage.this, "That user already exists ", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(BronzeActivationPage.this, "Could not login ", Toast.LENGTH_LONG).show();
}
}
progressDialog.dismiss();
}
});
}
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
https://stackoverflow.com/questions/46445265/android-8-0-java-lang-illegalstateexception-not-allowed-to-start-service-inten
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
https://stackoverflow.com/questions/46445265/android-8-0-java-lang-illegalstateexception-not-allowed-to-start-service-inten