I have Activity with the authorization form, after user authentication creating new Activity.
Next, close the application and start again. Again, a window with the authorization form.
How to make that opened immediately following window after window with authorization if the user has previously logged on?
p.s Sorry for my English.
I would structure the app differently. I would start the app with your "next" activity - the actual app functionality. In its onCreate, I would check whether the authorisation has been completed in the past. If yes, just continue with the app. If not, then open a dialog or start another activity for authentication.
Related
I have an app in which a user has to sign up/ sign in to view content (the destination link).
Currently, when I create a dynamic link in the firebase console, and I open the link on the android device, the link directs to the playstore as expected. After installing the app, the playstore says continue, after which the content view is directly opened, instead of waiting for my call of AppInvite.AppInviteApi.getInvitation() in another activity, post sign in / sign up.
I do have autoLinkOpen set to true, but I suppose the link should be auto launched after my call to AppInvite.AppInviteApi.getInvitation()
Edit: I'm observing that this happens only after tapping on 'Continue' in playstore, post installing the app. If, the playstore is closed after installing the app, and the app is launched from the home screen launcher, the process works perfectly fine.
Any ideas on how to fix this situation ?
I finally found a work around. I'm directing my deeplink to a specific activity which will handle all the deeplinks and route them appropriately. In this activity, I'm checking if the user has logged in. If not, I cache the deeplink url in a pref. Then, before doing my getInvitation method call, I'm checking if any deeplink has been cached in the pref. If so, I open that deeplink appropriately.
There is a verification link in activity. On clicking that link gmail app opens.User can verify through that mail. Now when users opens that activity again, the verification link should stay or go according to the response from api. The issue is after opening the activity,link disappears after fraction of second giving a flicker effect. I wan't that when activity is opened, if verification is true, link doesn't appear
I have an internal-use Android app which requires users to always login. My app consists of a dashboard which will have 4 available actions on it to perform.
What is the best practice? Set LoginActivity to be the main activity, or use the DashboardActivity as the main and on startup show login screen if user is not logged?
Thanks!
I would recommend using the login activity and use SharedPreferences to pass on the username once the user logs in correctly to the app for the first time. The user would remain logged in until he logs out of it (either manually or by deleting the app data from the phone settings).
The function of the SharedPrefences is to keep the user details in the app, even after the user goes to a different app. The credentials are kept when he/she uses them again once the user uses the app again. If you have developed for web applications beforehand, it is somewhat similar to the function of cookies, only more secure, since these credentials are kept hidden in the app.
A very good tutorial on how to implement this.
You can use the first loginActivitiy for the first time a user logs in. Then once the user returns to the app, he/she would be taken to the main page of the app (the next activity after a login is successful). This can be achieved though a few lines of code as in this post.
I'm building an android app, and i'm stuck with a feature that i want to implement at the login with google plus page. I implemented the activity and it works fine. But my problem is the following. I have a start activity and I want to check in this activity whether its the user first sign in or not? if it is i will direct him to the the login activity. if he already signed in i will just connect him in the onStart() and direct him to the main activity. Any clue how I can proceed.
I created an Android application that requires a user to login. After this, the user is able to see a menu with different information, including a background service that send a notification to the user when he is at an specific place. The problem is that if the user hits the back button and closes the application, when he tries to see the notification the application restarts again, therefore, he is asked for his credentials again... Is there a way that an application doesn't ask the user's credentials if he has signed in previously? (Just like fb and such apps?). Thank you very much.
The reason why apps like FB remain logged in is because they use an authorization token which allows them to stay logged in for as long as the token is valid and recognized by the server (which can literally be forever). In your app, I'm guessing that you do not have this authorization token or if you do, it is valid only as long as the app is not closed (the onDestroy() method is not called).