Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

forcedotcom/SalesforceMobileInterfaces-Android

A collection of Android interface libraries designed for mobile plugins that integrate with Salesforce mobile applications. This library provides standardized interfaces for common mobile operations like networking, logging, navigation, user management, and caching.

Overview

SalesforceMobileInterfaces serves as a bridge between Salesforce mobile applications and their plugins, providing a unified set of interfaces that enable plugins to access host application capabilities while maintaining clean separation of concerns.

Features

  • 🌐 Network Interface: Standardized networking with authentication and context awareness
  • 📝 Logging Interface: Structured logging with configurable severity levels
  • 👤 User Management: User, organization, and community data models
  • 🧭 Navigation Interface: Navigate to Salesforce records, objects, and URLs
  • 💾 Cache Interface: Async data caching with user-scoped operations

Requirements

  • Android API level 24+
  • Kotlin 1.8+
  • Android Studio Arctic Fox (2020.3.1) or newer

Installation

Gradle

Add the following to your project'ssettings.gradle.kts file:

dependencyResolutionManagement {    repositories {        google()        mavenCentral()    }}

Modules

SalesforceNetwork

Provides networking capabilities with built-in authentication and context management.

importcom.salesforce.android.mobile.interfaces.network.Networkimportcom.salesforce.android.mobile.interfaces.network.NetworkRequestimportcom.salesforce.android.mobile.interfaces.network.NetworkResponse// Implement the Network interface in your host applicationclassMyNetworkService :Network {overridesuspendfunperform(request:NetworkRequest):NetworkResponse {// Implementation with authentication, retries, etc.returnNetworkResponse(            request= request,            statusCode=200,            headers=mapOf("Content-Type" tolistOf("application/json")),            body="response data".toByteArray()        )    }}

SalesforceLogging

Structured logging interface with error, warning, and info levels.

importcom.salesforce.android.mobile.interfaces.logging.Logger// Implement logging in your host applicationclassMyLogger :Logger {overridefune(message:String) {// Log error message    }overridefune(message:String,exception:Throwable) {// Log error message with exception    }overridefunw(message:String) {// Log warning message    }overridefunw(message:String,exception:Throwable) {// Log warning message with exception    }overridefuni(message:String) {// Log info message    }overridefuni(message:String,exception:Throwable) {// Log info message with exception    }}

SalesforceUser

Data models for Salesforce users, organizations, and communities.

importcom.salesforce.android.mobile.interfaces.user.Userval user=User(    userId="005XXXXXXXXXXXXXXXXX",    org= myOrg,    username="user@example.com",    displayName="John Doe",    firstName="John",    avatarUrl="https://example.com/avatar.jpg")

SalesforceNavigation

Navigation interface for moving between Salesforce destinations.

importcom.salesforce.android.mobile.interfaces.navigation.Navigation// Implement navigation in your host applicationclassMyNavigationService :Navigation {overridefunnavigateTo(destination:Destination) {// Navigate to records, object homes, URLs, etc.    }overridefunnavigateTo(destination:Destination,replace:Boolean) {// Navigate with replacement control    }}

SalesforceCache

Async caching interface for user-scoped data storage.

importcom.salesforce.android.mobile.interfaces.cache.Cache// Implement caching in your host applicationclassMyCacheService :Cache {overridesuspendfunsave(data:ByteArray,key:String) {// Save data to cache    }overridesuspendfunload(key:String):ByteArray? {// Load data from cachereturnnull    }overridesuspendfunremove(key:String) {// Remove specific cache entry    }overridesuspendfunremoveAll() {// Clear all cache data    }}

Usage

These interfaces are designed to be implemented by host applications and passed to plugins. Here's a typical integration pattern:

// In your host applicationval networkService=MyNetworkService()val logger=MyLogger()val navigation=MyNavigationService()val cache=MyCacheService()// Pass to your pluginval plugin=SomePlugin(    network= networkService,    logger= logger,    navigation= navigation,    cache= cache)

Development

Building the Project

  1. Clone the repository
  2. Open the project in Android Studio
  3. Sync the project with Gradle files
  4. Build the project using Gradle
./gradlew build

Running Tests

./gradlewtest

Contributing

Please read our contribution guidelines and ensure all tests pass before submitting pull requests.

License

Copyright (c) 2011-present, salesforce.com, inc. All rights reserved.

SeeLICENSE.txt for full license terms.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp