+ Start a Discussion

Need guidance or consulting to create automatic login for Android app

I'm working with a programmer on a native Android app.  In the current version, I have to go through a Salesforce login screen in order for the app to transfer its information to the Salesforce database.

Am I right that the app can signin automatically?  If so, can you point me to the instructions to do this?  Or can you give some paid time to guide my programmer to a solution?

If I create an automatic signin, what's the best way to avoid having to change passwords and tokens while still maintaining security?  Create a user with "password never expires" and very limited permissions?

Thanks for your help,
Hi Baird, 

You should configure the OAuth for the mobile app which will itself ask if you want to use the Authentication and proceed to login. 

See the blog below, 

SSO and OAuth, 


Blog with screenshots, 


Daisy ScottDaisy Scott
Please contact at  info@janbask.com and we will get in touch with you with all details.....or visit http://www.janbask.com/
Alice SmithAlice Smith
While first time login you get a username or userid. Check out the below steps:

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(YourActivity.this); prefs.edit().putInt("userid",userid).commit();

After succesfull login this will store your userid in preference and you can check you are already login.

int Userid; prefs = PreferenceManager.getDefaultSharedPreferences(YourActivity.this); Userid= mPrefs.getInt("userid", 0); which will return defalut value 0 if u are not login

After check

if(Userid>0){ // Means you are already logged in do here code what you want if you are login }else{ // Means you are not logged in than go to your login pageview from here }

This is simple way for doing what you want suppose if you want logoout functionality on button click than onclick event you have to add following code for logout which will clear prefernce.

prefs = PreferenceManager.getDefaultSharedPreferences(MyAccountActivity.this); prefs.edit().clear().commit();

Alice Smith