function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Baird_SBaird_S 

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,
Baird
Ashish_SFDCAshish_SFDC
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, 

https://developer.salesforce.com/page/Single_Sign-On_for_Desktop_and_Mobile_Applications_using_SAML_and_OAuth

Blog with screenshots, 

http://stackoverflow.com/questions/9843740/salesforce-on-ios-login-without-using-the-salesforce-webview


Regards,
Ashish
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
http://www.fixithere.net/apple-customer-service/