- Notifications
You must be signed in to change notification settings - Fork0
License
forcedotcom/SalesforceMobileInterfaces-Android
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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.
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.
- 🌐 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
- Android API level 24+
- Kotlin 1.8+
- Android Studio Arctic Fox (2020.3.1) or newer
Add the following to your project'ssettings.gradle.kts file:
dependencyResolutionManagement { repositories { google() mavenCentral() }}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() ) }}
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 }}
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")
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 }}
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 }}
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)
- Clone the repository
- Open the project in Android Studio
- Sync the project with Gradle files
- Build the project using Gradle
./gradlew build
./gradlewtestPlease read our contribution guidelines and ensure all tests pass before submitting pull requests.
Copyright (c) 2011-present, salesforce.com, inc. All rights reserved.
SeeLICENSE.txt for full license terms.
About
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.