Coder Social home page Coder Social logo

salesforcemobilesdk-android's Introduction

Salesforce.com Mobile SDK for Android

CircleCI Known Vulnerabilities GitHub release (latest SemVer)

You have arrived at the source repository for the Salesforce Mobile SDK for Android. Welcome! Starting with our 2.0 release, there are now two ways you can choose to work with the Mobile SDK:

  • If you'd like to work with the source code of the SDK itself, you've come to the right place! You can browse sample app source code and debug down through the layers to get a feel for how everything works under the covers. Read on for instructions on how to get started with the SDK in your development environment.
  • If you're just eager to start developing your own application, the quickest way is to use our npm binary distribution package, called forcedroid, which is hosted on npmjs.org. Getting started is as simple as installing the npm package and launching your template app. You'll find more details on the forcedroid package page.

Installation (do this first - really)

After cloning the SalesforceMobileSDK-Android project from github, run the install script from the command line:

./install.sh

This pulls submodule dependencies from github.

(Windows users: run cscript install.vbs from the command line instead.)

Introduction

What's New in 12.1.0

See release notes.

Native Applications

The Salesforce Mobile SDK provides essential libraries for quickly building native mobile apps that seamlessly integrate with the Salesforce cloud architecture. Out of the box, we provide an implementation of OAuth2, abstracting away the complexity of securely storing refresh tokens or fetching a new session ID when a session expires. The SDK also provides Java wrappers for the Salesforce REST API, making it easy to retrieve, store, and manipulate data.

Hybrid Applications

HTML5 is quickly emerging as dominant technology for developing cross-platform mobile applications. While developers can create sophisticated apps with HTML5 and JavaScript, some limitations remain, specifically: session management, access to the camera and address book, and the inability to distribute apps inside public App Stores. The Salesforce Mobile Container makes possible to combine the ease of web app development with power of the Android platform by wrapping a web app inside a thin native container, producing a hybrid application.

Setting up your Development Environment

The following steps will help you get started with your development environment, whether you choose to develop native apps or hybrid apps. See the README files in the native/ and hybrid/ folders for additional notes pertaining to development in those environments.

  1. Install the Android SDK and Android Studio: http://developer.android.com/sdk/index.html
  2. Get setup on github: http://help.github.com/

Downloading the Salesforce SDK

To pull down the SDK from github, create a new directory and git clone the salesforce SDK repo.

git clone https://github.com/forcedotcom/SalesforceMobileSDK-Android.git

Documentation

Discussion

If you would like to make suggestions, have questions, or encounter any issues, we'd love to hear from you. Post any feedback you have on the Mobile SDK Trailblazer Community.

salesforcemobilesdk-android's People

Contributors

aghoneim avatar akhileshgupta avatar ashishmo avatar bbirman avatar bhariharan avatar booker-laputa avatar brandonpage avatar chrlie avatar dbreese avatar eoksman avatar eric-romero avatar gkotula avatar helenren avatar humaggie avatar ivansfdc avatar jamiehouston avatar jasonschroeder-sfdc avatar johnsonericatsalesforce avatar kchitalia avatar khawkins avatar ktanna avatar mdeblase avatar rwhitley avatar semipermeable avatar smcnulty-sfdc avatar superfell avatar tddium avatar tstellanova-sfdc avatar tysonbunch avatar wmathurin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

salesforcemobilesdk-android's Issues

No value for externalIdPath

I am currently developing a hybrid/offline capable app for a customer and was having issues with the smartstore calls to get the next page for a cursor with more records than the page size - moveCursorToNextPage would never move on (the code lifted from the CloudTunes app would go into an infinite loop). Additionally moving to a given index would never move on from the first page.

To resolve this I refreshed to the latest Salesforce Mobile SDK - in the hope that it had been resolved (my previous version was over a month old). Unfortunately now the app does not make it further than attempting to upsert into a soup - giving the error 'No value for externalIdPath'.

I followed the instructions to ensure I had the correct versions of everything. I also set up the Cloud Tunes app again (Tutorial 7) and noted that this also no longer works, giving the same error as above.

Am happy to assist/work with you on this to move it along - as we are developing a commercial app.

Force Closes

Hello,

I am able to import the projects into Eclipse and am able to get them to be error free but whenever I try to run in my AVD it ends up force closing. Any thoughts?

Trying to run the ContactExplorer app. Changed my remote app info. Made sure to also import the SalesforceSDK project into my workspace as well. I have Android 2.2 and Android Dependencies libraries checked. Also, under the Android settings in Eclipse I have added the SalesforceSDK project as a Library. I'm not sure if it is then supposed to show up as a library option under build paths or not but as of now it does not. I have also tried making the SalesforceSDK project a required project in the build path but that did not help or hurt my cause.

My AVD is simply Target: Android 2.2 - API Level 8 with 100 MiB SD Card, Built-in: WVGA800, and Abstracted LCD density 240 and Max VM application 24

Thanks,

nick

Add account via settings shows oauth error screen

If i try and add an account for an SDK based app via settings -> accounts & sync -> add account, an oauth error screen is shown instead of the login page (error=invalid_client_id) you can see this with the provided SFDCAccounts demo app. (this is using the current code in the master branch). This is on OS 2.3.6, haven't tried any other OS versions.

Need to Build native/SalesforceSDK before building any Android project

While trying to set up a new native & hybrid project for Android, I received the following error multiple times when trying to run the $ ant clean debug function :
BUILD FAILED
/Users/jbaltz/android-sdk-macosx/tools/ant/build.xml:451: The following error occurred while executing this line:
/Users/jbaltz/Code/SalesforceMobileSDK-Android/native/SalesforceSDK/build.xml:7: Source resource does not exist: /Users/jbaltz/Code/SalesforceMobileSDK-Android/native/SalesforceSDK/local.properties

And I realized that I needed to run the $ANDROID_SDK_DIR/tools/android update project command on the SalesforceMobileSDK-Android/native/SalesforceSDK folder. Once I ran that command, the local.properties file was created in that directory, and the $ ant clean debug command ran successfully.

This doesn't seem to be mentioned anywhere in any documentation.

Issue on Motorola Xoom 2 When going offline.

I am building a hybrid app in Android SDK.

Everything is now working except for offline mode.

I have created the manifest file, which lists all of my pages & resources. But whenever I turn off the WiFi, my app responds with:

Sorry!
The Application MYAPPNAME (process MY.PROCESS) has stopped unexpectedly. Please Try again.

And this is the only response I can get until I turn WiFi back on.

Here is the logcat output:

08-08 17:05:01.406: E/AndroidRuntime(20479): FATAL EXCEPTION: main
08-08 17:05:01.406: E/AndroidRuntime(20479): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x10000010 (has extras) } in com.salesforce.androidsdk.auth.HttpAccess@4065e9b0
08-08 17:05:01.406: E/AndroidRuntime(20479): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:734)
08-08 17:05:01.406: E/AndroidRuntime(20479): at android.os.Handler.handleCallback(Handler.java:587)
08-08 17:05:01.406: E/AndroidRuntime(20479): at android.os.Handler.dispatchMessage(Handler.java:92)
08-08 17:05:01.406: E/AndroidRuntime(20479): at android.os.Looper.loop(Looper.java:132)
08-08 17:05:01.406: E/AndroidRuntime(20479): at android.app.ActivityThread.main(ActivityThread.java:4134)
08-08 17:05:01.406: E/AndroidRuntime(20479): at java.lang.reflect.Method.invokeNative(Native Method)
08-08 17:05:01.406: E/AndroidRuntime(20479): at java.lang.reflect.Method.invoke(Method.java:491)
08-08 17:05:01.406: E/AndroidRuntime(20479): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-08 17:05:01.406: E/AndroidRuntime(20479): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-08 17:05:01.406: E/AndroidRuntime(20479): at dalvik.system.NativeStart.main(Native Method)
08-08 17:05:01.406: E/AndroidRuntime(20479): Caused by: java.lang.NullPointerException
08-08 17:05:01.406: E/AndroidRuntime(20479): at com.salesforce.androidsdk.auth.HttpAccess.onReceive(HttpAccess.java:163)
08-08 17:05:01.406: E/AndroidRuntime(20479): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:725)
08-08 17:05:01.406: E/AndroidRuntime(20479): ... 9 more

Hybrid App on Galaxy Tab 2 10.1

I have a hybrid app (connecting to visualforce) using SalesforceMobileSDK-Android.

The app works fine in emulator, however when runnign on Galaxy Tab 2 (10.1) The app unexpectidly quits whenever it is launched.

I have the following from logcat:

07-03 14:55:36.351: E/AndroidRuntime(13245): FATAL EXCEPTION: main
07-03 14:55:36.351: E/AndroidRuntime(13245): java.lang.RuntimeException: Unable to create application com.fluffyduck.mallard.MallardApp: java.lang.NullPointerException
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3971)
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.app.ActivityThread.access$1300(ActivityThread.java:128)
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.os.Handler.dispatchMessage(Handler.java:99)
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.os.Looper.loop(Looper.java:137)
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.app.ActivityThread.main(ActivityThread.java:4514)
07-03 14:55:36.351: E/AndroidRuntime(13245): at java.lang.reflect.Method.invokeNative(Native Method)
07-03 14:55:36.351: E/AndroidRuntime(13245): at java.lang.reflect.Method.invoke(Method.java:511)
07-03 14:55:36.351: E/AndroidRuntime(13245): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
07-03 14:55:36.351: E/AndroidRuntime(13245): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
07-03 14:55:36.351: E/AndroidRuntime(13245): at dalvik.system.NativeStart.main(Native Method)
07-03 14:55:36.351: E/AndroidRuntime(13245): Caused by: java.lang.NullPointerException
07-03 14:55:36.351: E/AndroidRuntime(13245): at com.salesforce.androidsdk.auth.HttpAccess.(HttpAccess.java:120)
07-03 14:55:36.351: E/AndroidRuntime(13245): at com.salesforce.androidsdk.auth.HttpAccess.init(HttpAccess.java:90)
07-03 14:55:36.351: E/AndroidRuntime(13245): at com.salesforce.androidsdk.app.ForceApp.onCreate(ForceApp.java:129)
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:973)
07-03 14:55:36.351: E/AndroidRuntime(13245): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3968)
07-03 14:55:36.351: E/AndroidRuntime(13245): ... 10 more

Any help would be much appreciated.

not getting any response from template app

hello,

i changed the soql query under onfetchaccountsclick to - "SELECT Name FROM Book__c"
here book is the custom object created as per given apex tutorial which by default has a name attribute.
but on clicking fetch accounts in the app i get error message as- invalid type and sObject of type Book__c is not supported.

the actual error can be seen in the screen shot attached.
error1

please revert on this issue soon.

regards,
akshay.

Japan Android not working

This is a hybrid implementation.

For Android for Japan we get JSON error login failure.

If the user were to type https://login.salesforce.com on their browser and go to the apex page, they are able to get in successfully.

Any help is appreciated.
thx
mahesh

RestResponse.consume() doesn't check if the response has already been consumed.

Seeing this in v1.3, but looking at the 1.4 code it appears to still have the same problem. this means if you do something that conumses the response then call consume(), you can end up with an exception with a stack track like this.

E/AndroidRuntime( 3633): Caused by: java.lang.IllegalStateException: Content has been consumed
E/AndroidRuntime( 3633): at org.apache.http.entity.BasicHttpEntity.getContent(BasicHttpEntity.java:84)
E/AndroidRuntime( 3633): at org.apache.http.conn.BasicManagedEntity.getContent(BasicManagedEntity.java:100)
E/AndroidRuntime( 3633): at android.net.http.AndroidHttpClient.getUngzippedContent(AndroidHttpClient.java:221)
E/AndroidRuntime( 3633): at com.salesforce.androidsdk.auth.HttpAccess$GzipDecompressingEntity.getContent(HttpAccess.java:433)
E/AndroidRuntime( 3633): at org.apache.http.util.EntityUtils.toByteArray(EntityUtils.java:64)
E/AndroidRuntime( 3633): at com.salesforce.androidsdk.rest.RestResponse.consume(RestResponse.java:100)
E/AndroidRuntime( 3633): at com.salesforce.chatterbox.lib.providers.ShareContentProvider.insert(ShareContentProvider.java:197)

this makes ensuring that the response is always consume messy because you can't just put consume() in a finally block.

how to update custom objects from android app..?

m trying to manually update the location in my sf database on clicking the update "button" on separate activity but the changes are not being made into my sf database...
update_error

i hv also written a code for toasting when the update has been successful but dat also doesnt work... pls guide..!!
@bhariharan

App crashes on first run after installation

Hi,

I have been consistently encountering a crashing issue while running an app referencing the SalesforceMobileSDK-Android after installation. I cloned the repo, ran the install scripts, then created a simple app from the TemplateApp. I used the SDK as a library project.

On first launch after install, the app crashes before the log-in page finishes loading. The error does not appear again after re-launching the app. Here's the log from LogCat:
D/AndroidRuntime( 1914): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1914): CheckJNI is ON
D/AndroidRuntime( 1914): --- registering native functions ---
I/ActivityManager( 59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.cludsherpas.test/.MainActivity }
I/ActivityManager( 59): Start proc com.cloudsherpas.test for activity com.cloudsherpas.test/.MainActivity: pid=1920 uid=10037 gids={3003}
D/AndroidRuntime( 1914): Shutting down VM
D/dalvikvm( 1914): Debugger has detached; object registry had 1 entries
I/dalvikvm( 1914): JNI: AttachCurrentThread (from ???.???)
I/AndroidRuntime( 1914): NOTE: attach of thread 'Binder Thread #3' failed
I/dalvikvm( 1920): Could not find method android.app.admin.DevicePolicyManager.getStorageEncryptionStatus, referenced from method com.salesforce.andr
idsdk.security.Encryptor.init
W/dalvikvm( 1920): VFY: unable to resolve virtual method 65: Landroid/app/admin/DevicePolicyManager;.getStorageEncryptionStatus ()I
D/dalvikvm( 1920): VFY: replacing opcode 0x6e at 0x001d
D/dalvikvm( 1920): VFY: dead code 0x0020-0029 in Lcom/salesforce/androidsdk/security/Encryptor;.init (Landroid/content/Context;)Z
I/ClientManager:getRestClient( 1920): No account of type com.cloudsherpas.test found
I/ActivityManager( 59): Start proc com.cloudsherpas.test:auth for service com.cloudsherpas.test/com.salesforce.androidsdk.auth.AuthenticatorService pid=1928 uid=10037 gids={3003}
I/ActivityManager( 59): Displayed activity com.cloudsherpas.test/.MainActivity: 979 ms (total 979 ms)
W/IInputConnectionWrapper( 121): showStatusIcon on inactive InputConnection
I/dalvikvm( 1928): Could not find method android.app.admin.DevicePolicyManager.getStorageEncryptionStatus, referenced from method com.salesforce.andridsdk.security.Encryptor.init
W/dalvikvm( 1928): VFY: unable to resolve virtual method 65: Landroid/app/admin/DevicePolicyManager;.getStorageEncryptionStatus ()I
D/dalvikvm( 1928): VFY: replacing opcode 0x6e at 0x001d
D/dalvikvm( 1928): VFY: dead code 0x0020-0029 in Lcom/salesforce/androidsdk/security/Encryptor;.init (Landroid/content/Context;)Z
I/Authenticator:addAccount( 1928): Options: Bundle[mParcelledData.dataSize=456]
I/ActivityManager( 59): Starting activity: Intent { flg=0x20000000 cmp=com.cloudsherpas.test/com.salesforce.androidsdk.ui.LoginActivity (has extras }
D/dalvikvm( 1920): GC_FOR_MALLOC freed 5038 objects / 333136 bytes in 46ms
W/dalvikvm( 1920): threadid=10: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 1920): FATAL EXCEPTION: Thread-11
E/AndroidRuntime( 1920): java.lang.IllegalStateException: CookieSyncManager::createInstance() needs to be called before CookieSyncManager::getInstance()
E/AndroidRuntime( 1920): at android.webkit.CookieSyncManager.getInstance(CookieSyncManager.java:81)
E/AndroidRuntime( 1920): at android.webkit.CookieManager$2.run(CookieManager.java:532)
E/AndroidRuntime( 1920): at java.lang.Thread.run(Thread.java:1096)
W/ActivityManager( 59): Force finishing activity com.cloudsherpas.test/com.salesforce.androidsdk.ui.LoginActivity
W/ActivityManager( 59): Force finishing activity com.cloudsherpas.test/.MainActivity
I/ActivityManager( 59): Displayed activity com.cloudsherpas.test/com.salesforce.androidsdk.ui.LoginActivity: 1081 ms (total 1081 ms)
I/Process ( 1920): Sending signal. PID: 1920 SIG: 9
I/ActivityManager( 59): Process com.cloudsherpas.test (pid 1920) has died.
W/InputManagerService( 59): Got RemoteException sending setActive(false) notification to pid 1920 uid 10037
D/dalvikvm( 1928): GC_EXPLICIT freed 2123 objects / 139200 bytes in 158ms

SFHybridApp.RemoteAppStartData is not working

When I try to use SFHybridApp.RemoteAppStartData I cannot go beyond the login screen and I get am getting an error message. However If I use FHybridApp.LocalAppStartData() I am able to open the index.html page. I tried both unstable20 and unstable branches and non of them work. I am still a newbie so I am not sure how to capture the logs so to see what exception it is throwing.

I saw a similar issue with SalesforceMobileSDK-IOS #211 (Error - 1804 : The requested scope is not allowed.)

UUIDManager has issues

  1. getUuId is synchronized but reset is not which can cause problems (as a reset could hapen while get is partially done).
  2. the uuids cache hashmap never has anything put in it. (which currently negates the problem with 1)

SalesforceMobileSDK-Android download has corrupt jar files

Been working on getting the walk through performed and after downloading the SDK zip file and and performing the "Getting Started" segment (http://wiki.developerforce.com/page/Building_Android_Applications_with_the_Force.com_REST_API); Eclipse states that the following jar files are not valid:

libs/guava-r09.jar
libs/cordova-1.8.1.jar
libs/sqlcipher.jar
dist/salesforcesdk.jar

This is the exact error message from Eclipse:

'filename', in project 'TemplateApp' cannot be read or is not a ZIP file.

Using winrar produces a similar error as well when attempting to open the mentioned jar files.

Thanks in advance!

Smartstore moveCursorToNextPage not working

I find that when I have more records in a soup that the size of the current cursor page and I want to query them all, then the smartstore call 'moveCursorToNextPage' does not actually move the current cursor page index on - it stays on the current (already processed) page.

e.g. if I create a basic soup with 21 records and then query it using:

var querySpec = navigator.smartstore.buildAllQuerySpec("Name", null, 20);
navigator.smartstore.querySoup( "testSoup",
querySpec,
function(cursor) { success(onSuccessQuerySoup(cursor)); },
error);

where the 'onSuccessQuerySoup' (below) is lifted from cloudtunes, then the app crashes in the commented infinite loop.

// from CloudTunes
function onSuccessQuerySoup(cursor) {
var entries = [];

function addEntriesFromCursor() {
    var curPageEntries = cursor.currentPageOrderedEntries;
    $j.each(curPageEntries, function(i,entry) {
       entries.push(entry);
    });
}

// Get the first page in - works fine
addEntriesFromCursor();

// INFINITE LOOP - currentPageIndex remains at zero
while(cursor.currentPageIndex < cursor.totalPages - 1) {
    console.log('page index = ' + cursor.currentPageIndex);
    navigator.smartstore.moveCursorToNextPage(cursor, addEntriesFromCursor);
}

navigator.smartstore.closeCursor(cursor);
return entries;

}

Layouts should use resource defined colors etc, to make it easy to customize the look.

The native layouts provided by the SDK typically have their color/style information hard coded directly in the layout (i.e. from sf_passcode.xml)

    <TextView android:id="@+id/sf__passcode_forgot"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="21dp"
        android:textColor="#000"
        android:gravity="center"
        android:clickable="true" />

It'd be better if these referred to resource values for layout & color info, so that they can be easily override to provide an UI consistent with the rest of the application. e.g. instead of android:textColor="#000" it should be android:textColor="@color/sf__passcode_text". The application using the SDK can then override the default from the SDK with its own color/layout info that matches the rest of its application.

Orientation Change Crashes App

Hybrid app is crashing when changing orientation from portrait to landscape. The log lines indicate that the app gets launched again:

01-10 18:56:21.605: I/SalesforceDroidGapActivity.unschedulePeriodicAutoRefresh(16274): unschedulePeriodicAutoRefresh called
01-10 18:56:21.676: D/DroidGap(16274): Origin to allow: https://.salesforce.com
01-10 18:56:21.684: D/DroidGap(16274): Origin to allow: https://
.force.com
01-10 18:56:21.691: I/CordovaLog(16274): Found log level DEBUG
01-10 18:56:21.691: I/CordovaLog(16274): Changing log level to DEBUG(3)
01-10 18:56:21.691: I/CordovaLog(16274): Found preference for classicRender
01-10 18:56:21.699: D/DroidGap(16274): DroidGap.onCreate()
01-10 18:56:21.699: D/DroidGap(16274): DroidGap.loadUrl(file:///android_asset/www/bootstrap.html)
01-10 18:56:21.699: D/DroidGap(16274): DroidGap: url=file:///android_asset/www/bootstrap.html baseUrl=file:///android_asset/www/
01-10 18:56:21.746: D/DroidGap(16274): DroidGap.init()
01-10 18:56:21.770: D/dalvikvm(16274): GC_CONCURRENT freed 400K, 8% free 11272K/12167K, paused 13ms+4ms, total 58ms
01-10 18:56:21.777: D/SalesforceDroidGapActivity:init(16274): User-Agent string: SalesforceMobileSDK/1.3.1 android mobile/4.1.1 (Galaxy Nexus) Logger/1.3.3 Hybrid Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; Galaxy Nexus Build/JRO03O) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
01-10 18:56:21.785: D/PluginManager(16274): init()
01-10 18:56:21.801: I/SalesforceOAuthPlugin.shouldAutoRefreshOnForeground(16274): false
01-10 18:56:21.801: I/SalesforceDroidGapActivity.schedulePeriodicAutoRefresh(16274): schedulePeriodicAutoRefresh called
01-10 18:56:21.816: D/SoftKeyboardDetect(16274): Ignore this event
01-10 18:56:21.910: I/SalesforceGapViewClient(16274): Setting 'about:blank' as the home page URL for this app
01-10 18:56:22.059: I/SalesforceDroidGapActivity.unschedulePeriodicAutoRefresh(16274): unschedulePeriodicAutoRefresh called
01-10 18:56:22.082: D/SoftKeyboardDetect(16274): Ignore this event
01-10 18:56:22.285: W/IInputConnectionWrapper(16274): showStatusIcon on inactive InputConnection
01-10 18:56:23.035: I/SalesforceGapViewClient(16274): Setting 'about:blank' as the home page URL for this app

ContactExplorer - cannot fetch contacts. using Android 4.2 (17)

When I try to 'Fetch Device contacts' from the device (using emulator) I am getting "Alert. Error getting device contacts!". The console reads "onErrorDevice: "JSON error"

I'm using the Android SDK tools r21.
I've tried AVD from:
5.1" WVGA
3.4" WQVGA

Application Cache empty in Ice Cream Sandwich and Jellybean

Our Android mobile app (Salesforce SDK 1.2) has been running live in the field both on and offline (as required) on Android version 2.2 with no issues.

We are due an upgrade and test devices for ICS and Jellybean are working online but we can no longer start it up offline.

I have done some initial investigation running the app up on emulators for Android versions 2.2, 2.3.3 and 4.1. I note that the Application cache size on startup is 781312 on both 2.2 and 2.3.3. Viewing this through a sql lite browser shows that the resources are all present. However on 4.1, the application cache is only 22525 and appears to be only metadata (ie browsing it shows the structure but it is empty).

To sum up, if we run the app up offline on versions 4.0 and 4.1 we get an error 'the url could not be found' whereas the app runs successfully on prior versions.

Are there any differences in the implementation that we need to know in order to keep our offline capabilities ?

login process aborts with WiMax connection

I have a hybrid Android application that was developed based on Mobile SDK.

The app works fine when it's connected via 3G or Wi-Fi.
But when it's connected via WiMax (http://en.wikipedia.org/wiki/Wimax), it aborts just after the login process completes with the following error.

"Sorry!
The application MyApp (myapp.com) has stopped unexpectedly. Please try again."

Here is the stack trace behind it.

06-14 10:33:49.234: W/AccMgrCallback:run(1481): android.accounts.OperationCanceledException
06-14 10:33:49.234: W/AccMgrCallback:run(1481): at android.accounts.AccountManager$AmsTask.internalGetResult(AccountManager.java:1232)
06-14 10:33:49.234: W/AccMgrCallback:run(1481): at android.accounts.AccountManager$AmsTask.getResult(AccountManager.java:1260)
06-14 10:33:49.234: W/AccMgrCallback:run(1481): at android.accounts.AccountManager$AmsTask.getResult(AccountManager.java:1181)
06-14 10:33:49.234: W/AccMgrCallback:run(1481): at com.salesforce.androidsdk.rest.ClientManager$AccMgrCallback.run(ClientManager.java:307)

After some investigation, we found this error could be resolved by modifying HttpAccess.java as follows.

diff --git a/native/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java b/native/SalesforceSDK/src/com/sales
index b3328de..b7e83d7 100644
--- a/native/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java
+++ b/native/SalesforceSDK/src/com/salesforce/androidsdk/auth/HttpAccess.java
@@ -145,6 +145,13 @@ public class HttpAccess extends BroadcastReceiver {
return;
}

+        // Try WiMAX data connection
+        NetworkInfo wimaxInfo = conMgr.getNetworkInfo(ConnectivityManager.TYPE_WIMAX);
+        if (wimaxInfo.isConnected()) {
+            setHasNetwork(true, null);
+            return;
+        }
+
// Try mobile connection
NetworkInfo mobileInfo = conMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

Would you mind evaluating this and including this to the product?

Thanks!

tools/symlink_files.txt out of date

Hi guys,

I am on windows 7 and today I followed the Mobile SDK Workbook and did the following

 git clone https://github.com/forcedotcom/SalesforceMobileSDK-Android
 cd SalesforceMobileSDK-Android
 cscript.exe install.vbs

the last command of which failed with the message

 Source file 'native\SalesforceSDK\res\drawable-hdpi\edit_icon.png' does not exist!  Cannot continue.

at which point I had a peek at install.vbs and tools/symlink_files.txt and it seems to me be out of date in that it contains the line

"native\SalesforceSDK\res\drawable-hdpi\edit_icon.png" "hybrid\SmartStorePluginTest\res\drawable-hdpi\edit_icon.png"

but there is no file edit_icon.png in native\SalesforceSDK\res\drawable-hdpi.

There is, however, a file sf__edit_icon.png. Do I need to get a new symlink_files.txt or a new install.vbs at all? Otherwise how can I address this issue?

All help appreciated :)

Regards,
Kyle

Improve Logging options

Currently the SDK logs various things though the standard Android log classes with a variety of different tags, this makes it hard to use the tag filtering capabilities of adb to see all your app specific logging.

it'd be nice if
a) I could tell the SDK a specific tag to use for all its logging
and/or
b) route log calls to something the SDK consumer can override (perhaps to route the logging to a different framework)

changing to sandbox url

I would like to change to the sandbox url without changing the source code. Is there a way please let me know
thx
mahesh

Not being able to run Sample hybrid app for Android using Salesforcemobile sdk

Using Mac.

Installed Android SDK.
Installed eclipse (Juno)
Installed Android ADT (from http://dl-ssl.google.com/android/eclipse

cloned SalesforceMobile SDK for android and ran ./install.sh

Imported VFConnector from SampleApps.

after importing , getting errors as:

R cannot be resolved to a variable
SalesforceR cannot be resolved to a type
SalesforceDroidGapActivity cannot be resolved to a type
The import com.salesforce.androidsdk cannot be resolved.
The method getKey(string) of type VFConnectorApp must override or implement a supertype method
The method getMainActivityClass() of type VFConnectorApp must override or implement a supertype method

The method getSalesforceR() of type VFConnectorApp must override or implement a supertype method

Please help.

SFHybridApp / deviceIsOnline problem on Android

I don't know whether this is a bug on android Webviews, or what it exactly is, but the fact is that navigator.connection.type always returns "0" on android. Because of that deviceIsOnline() always returns true.
By using navigator.network.connection.type instead of navigator.connection.type I solved my problem, but Cordova complains that navigator.network.connection is being deprecated.
I changed deviceIsOnline() to this:

    var deviceIsOnline = function() {
        var connType;

        if ((device.platform === "Android") && navigator && navigator.network && navigator.network.connection) {
            connType = navigator.network.connection.type;
            logger.logToConsole("deviceIsOnline connType: " + connType);
        } else {
            if ((device.platform === "iOS") && navigator && navigator.connection) {
                connType = navigator.connection.type;
                logger.logToConsole("deviceIsOnline connType: " + connType);
            } else {
                logger.logToConsole("deviceIsOnline connType is undefined.");
            }
        }

        if (typeof connType !== 'undefined') {
            // Cordova's connection object.  May be more accurate?
            return (connType != null && connType != Connection.NONE && connType != Connection.UNKNOWN);
        } else {
            // Default to browser facility.
            return navigator.onLine;
        }
        alert("ENDING deviceIsOnline!!!");
    };

EDIT: I do know that SFHybridApp.js belongs to Shared, but since it only affects Android I decided to post it here.

sample hybrid code

Hi

I am using the hybrid application sample code. Even though the function

function loginSuccess(oauthCredentials)

in the bootstrap.html says success, the salesforce page ask for login and password. Once i logined with the user name, it does not ask and later on it prompts me.

This is happening in the simulator as well as android

thanks

regards

mahesh

Hybrid sample app prompts for login after a day

When I first run the hybrid sample app, I login and it works fine for about a day without prompting for login on repeated restarts of the app. Then after the first day I am prompted for a login every time my application starts. My hunch is that the access token is not being updated from the refresh token.

allow an easy to override/subclass LoginActivity

It'd be useful to break up the current LoginActivity class into the various peices (webview support, parsing etc) from the UI specific code, and make it possible to use an alternative LoginActivity to present the login UI, this would be useful if you're app is trying to use the action bar for example.

Activation Code gets disabled frequently

Hi:

Access to the Hybrid app through oAuth 2.0 Access screen does not work consistently. As soon as I exit out of the App, and log in again, a request to enter new activation code appears. This annoys end users, as they have to check their email frequently.

Please suggest solution.

Thanks.
kshankar

CipherCloud Integration error

Hi there,

We have just experienced a problem that redirect the url using SF Mobile SDK after login through CipherCloud gateway (https://login-salesforce-com.pilot3.ciphercloud.net/).

The problem was after login through CipherCloud login page, ex: https://login-salesforce-com.pilot3.ciphercloud.net/, the mobile SDK returns normal SF url (like, https://ap1.salesforce.com) instead of CipherCloud gateway url (https://ap1-salesforce-com.pilot3.ciphercloud.net/).

Can you guys give us some advices on this?

Cheers

Tao

Can we make SqlCipher optional somehow ?

The SqlCipher dependency that the SDK now has adds a considerable size to the final APK and app size (I moved an app from 1.1 SDK to current, and the APK when from 800K to 2.5Mb and the installed app size went from 2Mb to 8Mb) Is there someway we can make this optional, perhaps split the current SDK library into 2, so that apps not using the SqlCipher related stuff aren't paying the significant cost in app size.

how to customize oAuth process

I need to customize the oAuth process including two steps.

  1. change the login server to sandbox, I do see it in LoginServerManager, but I do not know how to make login points to sandbox
  2. instead of default login page, I will create my own login page, ask user to type in username/password other than SF's username/password, behind the scene, I will use the username/password to oAuth the user
    Could you provide some hints?

Default--TemplateApp

hi,

Result I need:----fetch contacts whenever a user login with salesforce account

I am able to fetch them using the default Template App provided by Sales Force.

But when I put my call back url, client id etc....I am able to login and when click on fetch contacts its toasting a message ---- "NOT_FOUND" : message:"the requested resource doesnt exist".

I gave all the Oauth scopes for my app in sales force developer account. what am i missing/doing wrong?

Also do I need to give consumer secret? I do not find any usage of consumer secret in default TemplateApp.

Please help me on this issue. Thanks in advance.

allow for a customizable userAgent header

Currently the userAgent is built up based on various SDK versions etc, however a client app might have the requirement to set a specific userAgent in its requests, this doesn't appear to be possible, getUserAgent() in ForceApp is final, and there doesn't appear to be a setter for it in HttpAccess.

LoginActivity progress

In LoginActivity.onLoadingProgress() it has

    if (loadSpinner != null) {
        loadSpinner.setVisibility(totalProgress < 100 ? View.VISIBLE : View.GONE);
    }
    if (loadSeparator != null) {
        loadSeparator.setVisibility(totalProgress < 100 ? View.VISIBLE : View.GONE);
    }

but the range of values sent to this method is 0..10000 (i.e. Window.PROGRESS_END)

RestResponse has wrong copyright header?

It says

/*

  • Copyright 2010 Salesforce.com.
  • All Rights Reserved.
  • Company Confidential.
    */

Which doesn't seem right for an open source library, all the classes i looked at had the BSD type license notice instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.