+ Start a Discussion
SandunSandun 

How to change Login URL from Production to Custom in Android Mobile

In the Salesforce iOS Mobile app (from SDK), I know you can change the login url (Production, Sandbox, or Custom) via  Settings|MyApp.

 

How can you do this for the Android (I am new to Android side of things) via UI instead of hard coding the URL in the Java or adding it to the servers.xml file.

 

I see a couple of references to this area in res/menu/sf_clear_custom_url.xml and res/menu/sf_login.xml, but do not see it exposed anywhere in the UI (e.g. in Settings etc.).

 

Is there some other configuration I need to do to enable this - for Android 4.03+, using Saleforce Mobile SDK 2.x, Hybrid.

 

Thanks.

 

Best Answer chosen by Admin (Salesforce Developers) 
bhariharanbhariharan
In the screen that shows the login webview, if you press the 'Menu' button
you'll see a 'Change Server' button, which will let you add a custom server
URL.

--
Sent from my iPhone

All Answers

bhariharanbhariharan
In the screen that shows the login webview, if you press the 'Menu' button
you'll see a 'Change Server' button, which will let you add a custom server
URL.

--
Sent from my iPhone
This was selected as the best answer
SandunSandun

Bhariharan,

 

Thank you for your prompt answer. I am able to see the 'menu' in the login screen and  can confirm that there are options to allow the user to pick production, sandbox or custom servers. This is on Android 2.3.3 API 10 target.(I was on 4.2.x).

 

The reason I did not see this before was our application is targeted for Android 4.03+/ICS/API 15 where there is no 'menu' button.

 

Any thoughts how to access the server settings UI on Android API 15+ targets? (as a last option, we can target API 10, just to this feature).

 

Thank you again for 'menu' in login screen tip.

 

bhariharanbhariharan

Currently, there's probably not much that can be done out of the box, if your app does not target API 10, since the menu button functionality is not available. The only possible workaround is to subclass LoginActivity and provide your own implementation that uses the newer ActionBar to display those options, as opposed to the menu button.

SandunSandun

Thank you again. I 'll  use API 10 as the min bar for the app so that the menu is available.