Class AppExtensionService
-
- All Implemented Interfaces:
public final class AppExtensionService extends MobileService
Represents the app extension service which provides the ability to let the client code access some readonly resources with a dedicated OAuth token. The service can be used for Android widget development which needs the ability to make API calls to the mobile services without requiring the user secure store be opened with the user's passcode.
-
-
Field Summary
Fields Modifier and Type Field Description private OAuth2WebOption
webOptionForAuth
private Boolean
enablePKCEForOAuth
private Application
application
private String
apiKey
-
Constructor Summary
Constructors Constructor Description AppExtensionService(AppConfig appConfig, Function1<List<AbstractOAuthClient>, OAuthClient> clientFilter, Function1<Boolean, Unit> serviceReadyListener)
AppExtensionService(AppConfig appConfig, Function1<List<AbstractOAuthClient>, OAuthClient> clientFilter)
AppExtensionService(AppConfig appConfig)
AppExtensionService()
-
Method Summary
Modifier and Type Method Description final OAuth2WebOption
getWebOptionForAuth()
Choose between WebView or Browser for authentication final Unit
setWebOptionForAuth(OAuth2WebOption webOptionForAuth)
final Boolean
getEnablePKCEForOAuth()
Set whether PKCE is enabled for OAuth final Unit
setEnablePKCEForOAuth(Boolean enablePKCEForOAuth)
Set whether PKCE is enabled for OAuth Unit
init(Application application, String apiKey)
Initializes the mobile service Unit
onStateChange(ApplicationState state)
Notified when application state changes. Unit
reset()
Resets the service final Unit
updateAppConfig(AppConfig appConfig, Boolean replace)
Updates the existing appConfig into the database. final Unit
updateAppConfig(AppConfig appConfig)
Updates the existing appConfig into the database. final AppConfig
getAppConfig()
Retrieves the current appConfig final AppExtensionService
resumeService()
Start/Resume the service. final AppExtensionService
pauseService()
Pause the service, after paused, the service will not response to any application state changes. final OkHttpClient
buildReadonlyOkHttpClient()
Retrieves the 'okhttp client' to access the readonly resources -
Methods inherited from class com.sap.cloud.mobile.foundation.mobileservices.MobileService
enableNetworkPolicy, getApiKey, getApplication, isApplicationInitialized, mayStartNewProcess, setApiKey, setApplication
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
AppExtensionService
AppExtensionService(AppConfig appConfig, Function1<List<AbstractOAuthClient>, OAuthClient> clientFilter, Function1<Boolean, Unit> serviceReadyListener)
- Parameters:
appConfig
- the optional app configuration information.clientFilter
- the filter to determine which OAuth client to be used to get the tokens to access the readonly resources at the server side.serviceReadyListener
- the callback listener which enables the client code response to the service ready or not status change.
-
AppExtensionService
AppExtensionService(AppConfig appConfig, Function1<List<AbstractOAuthClient>, OAuthClient> clientFilter)
- Parameters:
appConfig
- the optional app configuration information.clientFilter
- the filter to determine which OAuth client to be used to get the tokens to access the readonly resources at the server side.
-
AppExtensionService
AppExtensionService(AppConfig appConfig)
- Parameters:
appConfig
- the optional app configuration information.
-
AppExtensionService
AppExtensionService()
-
-
Method Detail
-
getWebOptionForAuth
final OAuth2WebOption getWebOptionForAuth()
Choose between WebView or Browser for authentication
-
setWebOptionForAuth
final Unit setWebOptionForAuth(OAuth2WebOption webOptionForAuth)
-
getEnablePKCEForOAuth
final Boolean getEnablePKCEForOAuth()
Set whether PKCE is enabled for OAuth
-
setEnablePKCEForOAuth
final Unit setEnablePKCEForOAuth(Boolean enablePKCEForOAuth)
Set whether PKCE is enabled for OAuth
-
init
Unit init(Application application, String apiKey)
Initializes the mobile service
-
onStateChange
Unit onStateChange(ApplicationState state)
Notified when application state changes. This function will be called on Main thread.
-
reset
Unit reset()
Resets the service
-
updateAppConfig
@JvmOverloads() final Unit updateAppConfig(AppConfig appConfig, Boolean replace)
Updates the existing appConfig into the database.
-
updateAppConfig
@JvmOverloads() final Unit updateAppConfig(AppConfig appConfig)
Updates the existing appConfig into the database.
-
getAppConfig
final AppConfig getAppConfig()
Retrieves the current appConfig
-
resumeService
final AppExtensionService resumeService()
Start/Resume the service.
-
pauseService
final AppExtensionService pauseService()
Pause the service, after paused, the service will not response to any application state changes.
-
buildReadonlyOkHttpClient
final OkHttpClient buildReadonlyOkHttpClient()
Retrieves the 'okhttp client' to access the readonly resources
-
-
-
-