After digging around in the Salesforce MobileSDK for Android, it seems clear that both of my problems are due to design decisions within the Android version of the SDK.
For #1, suppressing the login page title bar probably could be accomplished by changing an AndroidManifest.xml
(possibly the app's; certainly the MobileSDK plugin's), except that the code assumes that title bar is present, and causes a null pointer exception if it isn't. So you'll have to modify the code.
First, update the plugin's manifest (plugins/com.salesforce/src/android/libs/SalesforceSDK/AndroidManifest.xml
), and find:
<!-- Login activity -->
<activity android:name="com.salesforce.androidsdk.ui.LoginActivity"
android:theme="@style/SalesforceSDK.ActionBarTheme" />
and change android:theme
to "@android:style/Theme.Black.NoTitleBar.Fullscreen"
. Next, open:
app/plugins/com.salesforce/src/android/libs/SalesforceSDK/src/com/salesforce/androidsdk/ui/LoginActivity.java
find the onCreate
and comment out these two lines:
// We'll show progress in the window title bar
getWindow().requestFeature(Window.FEATURE_PROGRESS);
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
Finally, find method loadingLoginPage
, and replace ab.setTitle(loginUrl);
with:
if (ab!=null) {
ab.setTitle(loginUrl);
}
You'll need to rebuild the sdk; cordova
doesn't seem to do so for me. I use the following:
cd platforms/android
ant debug # or ant release for release version
For #2, serving files from localhost inside the login view, it looks like the app's main web view is an instance of SalesforceDroidGapActivity
which has support for localhost urls (via SalesforceIceCreamWebViewClient
), but the login page is an instance of LoginActivity
which extends AccountAuthenticatorActivity
, and has no localhost support. Dropping in one for the other doesn't look practical either. I think the login view should have access to file://
urls, but I'm not sure if the cordova js file and plugins would be accessible via such a file url; I'll update this post if I learn more.