You need to sign in to do that
Don't have an account?
Stefan Fellner
Login Validation - Android SDK
Hello,
I have the following objective regarding to the login process of my android based salesforce app:
Depending on a user has been logged in / out or rather his login data (authToken,...) is still valid / invalid, I want to trigger different mechanisms.
Is it a save way if I check on the currently logged in UserAccount to be !null / null, like this:
UserAccount loggedInUserAccount = SmartSyncSDKManager.getInstance().getUserAccountManager().getCurrentUser();
if (loggedInUserAccount != null) {
//Trigger mechanism 1
} else {
//Trigger mechanism 2
}
Thank you in advance
stefan
I have the following objective regarding to the login process of my android based salesforce app:
Depending on a user has been logged in / out or rather his login data (authToken,...) is still valid / invalid, I want to trigger different mechanisms.
Is it a save way if I check on the currently logged in UserAccount to be !null / null, like this:
UserAccount loggedInUserAccount = SmartSyncSDKManager.getInstance().getUserAccountManager().getCurrentUser();
if (loggedInUserAccount != null) {
//Trigger mechanism 1
} else {
//Trigger mechanism 2
}
Thank you in advance
stefan
I think you can simply do
If the user Id is not null, you have a valid session. Makes sense?
If my answer helps resolve your query, please select it as a 'Best Answer' so that it benefits others and helps us improve the overall quality of the forums.
the reason why I can not use the RestClient, is the fact that I am not extending the SalesforceActivity and therefore do not get the client through onResume(RestClient restClient) method.
My goal is to know if the user needs to log in or not, before going to the login screen. With the above described approach it seems to work out well. I am just not confident that this is reliable in case e.g. the access token expires.
Thank you for clarifying on that!
Stefan