You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.
I have an issue with synchronous login when I call it from the main thread. I wanted to make my login synchronous because I use it in Rx chain and I don't want to have callbacks.
Response<ResponseZerokitLogin, ResponseZerokitError> r = Zerokit.getInstance().login(zerokitId, mPasswordET.getPasswordExporter(), true).execute();
Here is my log:
java.lang.IllegalStateException: Sync method call from the main thread is only possible after the initialization was finished.You can call sync method from background thread any time, or from main thread after the initialization is done. You can call async method from any looper thread any time
at com.tresorit.zerokit.Zerokit$CallAction.checkThreadSync(Zerokit.java:1407)
at com.tresorit.zerokit.Zerokit$CallAction.execute(Zerokit.java:1447)
at de.gesundheitscloud.sdk.view.HCLoginActivity$1.onClick(HCLoginActivity.java:44)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
I have also tried to do initialize zerokit again with: Zerokit.getInstance().initMain(); but then I get ANR when I try to login.
The text was updated successfully, but these errors were encountered:
Hi,
The Zerokit.getInstance().initMain(); is not enough, because this call only returns a Call instance, so you need to call enqueue(new Action<Void>() {...} on it, because it is an async call.
The initMain() can only be called async, but after it has finished, you can call sync methods from main thread also. (From background thread you can call sync methods any time without the init restriction)
Zerokit.getInstance().initMain().enqueue(new Action<Void>() {
@Override
public void call(Void aVoid) {...}
});
I have tested other methods like getIdentityTokens(String clientId).execute() synchronous and it worked.
But synchronous login Zerokit.getInstance().login(zerokitId, PasswordET.getPasswordExporter(), true).execute() method is not working. I always get ANR or this message: Sync method call from the main thread is only possible after the initialization was finished. You can call sync method from background thread any time, or from main thread after the initialization is done. You can call async method from any looper thread any time.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have an issue with synchronous login when I call it from the main thread. I wanted to make my login synchronous because I use it in Rx chain and I don't want to have callbacks.
Here is my log:
I have also tried to do initialize zerokit again with:
Zerokit.getInstance().initMain();
but then I get ANR when I try to login.The text was updated successfully, but these errors were encountered: