Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to maintain one time login in android screenlet app ?
Hi Everyone,
I have created an android liferay screenlet app. The app is working fine but there is an annoying issue while using.
If a user install that app, a token for his mobile number is added in pushnotifications device section.
Now everytime this user gets notification, to check his notification he has to perform authentication
Also user has to authenticate whenever he opens his app first time by clicking its icon on mobile.
Is there any way that user has to authenticate himself only once. After that whenever his gets notification he can see it without login. Similarly he shouldn't login to open this app.
Does user name, and token for his mobile should be saved along with his login critential in database.
Waiting for guidance.
Thanks and Regards,
Amit.
I have created an android liferay screenlet app. The app is working fine but there is an annoying issue while using.
If a user install that app, a token for his mobile number is added in pushnotifications device section.
Now everytime this user gets notification, to check his notification he has to perform authentication
Also user has to authenticate whenever he opens his app first time by clicking its icon on mobile.
Is there any way that user has to authenticate himself only once. After that whenever his gets notification he can see it without login. Similarly he shouldn't login to open this app.
Does user name, and token for his mobile should be saved along with his login critential in database.
Waiting for guidance.
Thanks and Regards,
Amit.
I think you are looking for something like this: https://www.youtube.com/watch?v=kEZEahTzuck
There has been some API changes but the basics are the same, to store the credentials and login before showing a screen to the user.
There has been some API changes but the basics are the same, to store the credentials and login before showing a screen to the user.
Thanks Javier,
with a little modifications in code, the code worked.
User do not have to re login every time.
some modification required were as below :
import com.liferay.mobile.screens.context.storage.CredentialsStorageBuilder;
instead of
// import com.liferay.mobile.screens.context.storage.CredentialsStoreBuilder;
SessionContext.loadStoredCredentials(CredentialsStorageBuilder.StorageType.SHARED_PREFERENCES);
instead of
// SessionContext.loadSessionFromStore(CredentialsStoreBuilder.StorageType.SHARED_PREFERENCES);
if (SessionContext.isLoggedIn()){}
instead of
// if (SessionContext.hasSession()) {}
and in activity xml file
app:credentialsStorage="shared_preferences"
instead of
<!-- app:credentialsStore="shared_preferences" -->
Once Again Thanks Javier.
Amit.
with a little modifications in code, the code worked.
User do not have to re login every time.
some modification required were as below :
import com.liferay.mobile.screens.context.storage.CredentialsStorageBuilder;
instead of
// import com.liferay.mobile.screens.context.storage.CredentialsStoreBuilder;
SessionContext.loadStoredCredentials(CredentialsStorageBuilder.StorageType.SHARED_PREFERENCES);
instead of
// SessionContext.loadSessionFromStore(CredentialsStoreBuilder.StorageType.SHARED_PREFERENCES);
if (SessionContext.isLoggedIn()){}
instead of
// if (SessionContext.hasSession()) {}
and in activity xml file
app:credentialsStorage="shared_preferences"
instead of
<!-- app:credentialsStore="shared_preferences" -->
Once Again Thanks Javier.
Amit.
Thanks to you