I have two apps that both require a user to be logged in before creating the app databases. One app is a launcher-type app that contains my AccountManager and links to my other apps. All of my apps request storage permissions since they need local databases.
The problem I am currently having is when opening the second app for the first time through the launcher app. If you open the app normally for the first time there is a splash screen that asks the user to select an account, and the storage permission dialog comes up here. But if the user opens the app for the first time through a deep link, this splash page is skipped (since the deep link goes to a different activity). So if the user opens the app for the first time from a deep link, I can make the permission dialog appear, but the app continues behind the popup and inevitably crashes because it cannot create its databases. I can enable the permission, then try to launch the app again and everything works, but this is not nice.
What would be the best way to handle this scenario? I was thinking about hacking together a way to freeze the app until the permission is accepted but I would prefer not to have to do that.
Related
Would it be okay to show the disclaimer (including about logo and trademark) only for the first opening of the app? Currently, my disclaimer is only shown on the first-use of the app, have an Accept button, and then it wouldn't be accessible to the user anymore.
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 am new to authenticating through social networks on android so pardon me. I created activity with which i can login through facebook and google. I am planning to do this : user comes first time, ask him to login through Google or Facebook, once he does, let him go to other activities. How do i handle scenario when user closed and restart my app. I want my app to work both offline and online.
Method 1 : I am planning to store a bit in my sqlite DB which notes that whether user signed in through any social network, if he done then go ahead. Don't open login page multiple times and directly give user access to other pages. Problem with this approach is that if i want user to publish on his wall then i need to get him log in again before publishing (if session token expires). Rest seems fine. Also i will provide him a sign out button with which i will clear this bit for next time login.
What do you guys think about this approach? How other people does this in their apps with multiple activities. Assuming this approach works fine if we don't need to access facebook/google again and just need to get basic user data to let him login. Drawback, even he remove my app from his facebook/google account, i give him full access until he logout.
Method 2: Always on app start i check if facebook has session.isOpen() or myGoogleClient.isConnected(). If any of this gives true, i let user go in my app. Make sure with what network user logged in and show him log out button of that network. This check will only come when user restart his app. Once user login, does he always logged in or he see lot of login pages? I feel this approach is better.
Do i need to check for session open condition on each activity when transactioning through activities?
Any suggestions what approach is used by different apps. I want my app to be accessed for data in offline mode, but still let user access online feature when he is online.
Even when he is logged in with google, i want him to publish on his wall with facebook login, so will ask him to do so if he clicks on publish button, this way at times i have both logins and will chose any on them.
Please show me directions. I tried to find this on net and reached to above conclusions, but not able to finalize on right approach.
We have a cordova app which needs to run on both iOS and Android. In this app, we need to open a webpage so that the user can login securely and then come back to the app with a generated token. We've looked at the inappbrowser plugin which allows us to open the system browser like this : window.open("http://loginWebsite", "_system"); and then we come back to the app with a custom URI scheme.
My problem with this is the page appears to stay open in the browser after the app is reoppened. On iOS it only leaves the last one open but on android it opens a new tab every single time, leaving them all open.
An alternate solution is to use the inappbrowser like so: window.open("http://loginWebsite", "_blank"); but this appears to give our developper team the possibility to inject code with executeScript in the login or credit card pages we would use. This kind of defeats the purpose of having our login be separate our app.
Are there any solutions or other options ? If possible we would rather have the login be completely separate but having an app leave a bunch of tabs open seems weird.
Thanks
We're using the Dropbox Core API to access a users's Dropbox account in our Android app:
https://www.dropbox.com/developers/core/start/android
When the user starts the app for the first time, he sees the following two Dropbox screens:
Screen 1:
Screen 2:
After the first successful authentication, we store the OAuth2 session key in the SharedPreferences, and use the key for all subsequent API access.
This seems to work: When the user starts the app the second time, Screen 1 doesn't appear, so we assume that we have used the session key correctly.
However, Dropbox still displays the second screen, asking the user for permission to link the app to his Dropbox account. No matter how many times the user has given permission to link the app, Screen 2 is always shown when the app is started.
Any idea what we're doing wrong?
Found the solution:
Instead of always calling
_dropboxApi.getSession().startOAuth2Authentication(MyActivity.this);
we are now checking if the session is already linked:
if (!_dropboxApi.getSession().isLinked()) {
_dropboxApi.getSession().startOAuth2Authentication(MyActivity.this);
}