secure from unauthorised access - android

Based on the user requirements, he wants to use our android application via pin code access like login whenever he starts to use this application. In Android or any mobile, most of the applications start again the last using layout. so which event should i call this login alertdialog to access each time users start to use it? Or let me know the better. Thank you.

You will have to add a snippet of code in each Activity you have so that it ask the user to type the user & password. If you are using normal activities I guess you can add the snippet inside methods like onRestoreInstanceState so that you can be sure it will be executed as soon as the user (re)open the activity.

Related

Android First time Accept Rules to Use

I want the user to accept my application rules and terms policy to run my app.
I've thought using SharedPreferences. But what is the best way to prompt user , who has just launched my app , to accept the rules?Create a new activity which always checks in the sharedPreferences and if the variable is not set to true it will not let the app begin(It will not launch Main Activity maybe?)?Can you help me with the code?I'm not experienced with using SharedPreferences.

Make login in one activity and logout in a second activity with google+

i am relative new with android developement.
I'm trying to create a small application that connects via google +.
I have two activity. The first contains the login and the second the main app . I was able to log in and start the second activity follow android wiki.
The problem is that I can not run the log out of the second activity .
What I want to achieve is something similar to the runtastic login .
Can anyone give me some suggestions , I have tried a lot on the net but have not found anything that could help me.
i recommend for you, Simply
http://www.androidhive.info/2014/02/android-login-with-google-plus-account-1/
first just you login, when you logged save the instance value 1 in sqlite database. when you want to logout just use that value to 0.
It work well, i mostly use this way for login and logout.
It might be useful.
one more way you can do this using broadcast receiver.
whenever you press logout pass broadcast message and get that message in all activity and make it finish using that message.
This is the best and simple way to logout from any activity.
Thankyou
hope this will help you and many more :)

Best practice to check and redirect to home or loginscreen on android

For example when you open facebook for android if you havent session automatically sends you to loginscreen. There are too many ways to do that. In your experience. What is the better practice to recognize the user state and redirect to the correct activity??
The best thing to do in this case is not to send the user to a different activity but rather just show a Log-in DialogFragment that the user can use to log in and hence removing the overhead from your end to keep track of the last activity the user was on. Just add this Login DialogFragment, authenticate the user and dismiss it.
i have same scenario in my app, as user d3m0li5h3r suggested ,i also used fragments,which is a good practice to avid overhead.Coming back to your question,you can use shared preferences ,in which you can set a flag to make sure whether user is already logged in or logged out,based on the flag you can load the fragment(log-in fragment or any other fragment) accordingly
refer this link to understand shared preference

Android - best practices for authorization

I am researching how to autenticate and authorize user within Android application
For autentication there is the AccountManager but I am not sure how to check whether the user is signed in or not. I know how to set up AccountAuthenticatorActivity and AuthenticatorService but I am not sure how its connected with the application.
Am I supposed to call some check on every onCreate in every activity to ensure that the user is signed in or does the service does that for me somehow?
If I am supposed to do some regular checking, what is the best practice towards where such checking should be called?
It depends on your application, really. Unless you have a requirement for very strict security, like a financial application, government application, etc. I think you could get by with a simpler approach. For example, after a user logs in (however you choose to implement this) store a value in SharedPreferences to denote the user has authenticated. From here, you could do one of the following:
If your application requires you authenticate every activity/fragment you launch, simply check this SharedPreferences value. You could also create a base activity that all your other activities extend and do your authentication check there.
If you only need to authenticate once, modify your launcher activity in your manifest to check for this value. If the user has authenticated already, create a new Intent for your 'home' activity and redirect your user and finish() the launcher activity.
As always, it depends. Do you need to protect the whole app? or some particular activities or some fragment in some activities. Take a look at Mint app.
It asks the user to enter pass code to access app. For something like this, create a base activity and make all activities in your app inherit this and do the checking in the base activity.
If you need to secure just some activities, create a base activity
just for these activities and do your security check there.
If it is for some portion of an activity, You have to roll up something specific for your workflow.
Just a tip, Try to split your question into smaller problems, it makes easier for people to answer.

Making a set up screen on first start up

I'm here today asking someone if they know a way to make a set up screen on first start up.
Here's the scenario: When someone downloads my app and uses it for the first time, it has to show a method where users make a password. On subsequent uses, I don't want it to be shown anymore. Does anybody know how to do this?
You can use the SharedPreferences for this purpose.
At the start of your application, check if the key "myKey+versioncode" is present or not in the SharedPreferences. If it not stored, then it means your application has not bee started yet, let the user create his/her password. Once the password is created, add the SharedPreferences "myKey+versioncode" with any value you like, and next time you will find this SharedPreferences, so it means the user already started the application and created its password.
However be careful about the "versionning" of this key, you might also want to keep a single key instead of one per version of your application.
Edit: Concept found at the time I was looking for EULA inplementation, here: Simple EULA implementation for Android

Categories

Resources