Class SharedDeviceService
-
- All Implemented Interfaces:
public final class SharedDeviceService extends MobileService
Represents the service to retrieve shared device settings, encryption key for offline database initialization, etc.
This service is for offline mobile application in multiple user mode, one device will be shared to different users.
When initializing offline database, an encryption key can be provided to enhance the security. To maximum the security, applicationKeyParameter is strongly recommended to be provided in the client code before initializing this service with SDKInitializer. Please note that once the application is deployed, applicationKeyParameter should not be changed, otherwise, the existing user will not be able to open the offline database.
The service has an internal algorithm to generate the encryption, to leverage this, encryptionKeyReadyListener should be also be provided, the generated encryption will be notified via this listener. Client code can also call the APIs in this service to retrieve encryption from server side, then generate key with customized algorithm.
-
-
Field Summary
Fields Modifier and Type Field Description private final ServiceListener<String>encryptionKeyReadyListenerprivate Applicationapplicationprivate StringapiKey
-
Constructor Summary
Constructors Constructor Description SharedDeviceService(String applicationKeyParameter, ServiceListener<String> encryptionKeyReadyListener)SharedDeviceService(String applicationKeyParameter)SharedDeviceService()
-
Method Summary
Modifier and Type Method Description final ServiceListener<String>getEncryptionKeyReadyListener()UnitonStateChange(ApplicationState state)Notified when application state changes. final ServiceResult<String>getCombinedEncryptionKey()Generates a secure encryption key to initialize offline database. final JobretrieveSharedDeviceSettings(ServiceListener<SharedDeviceSettings> listener)Retrieves the shared device setting from the main thread, listener will contain either the result or the error message final ServiceResult<SharedDeviceSettings>retrieveSharedDeviceSettings()Retrieves the shared device setting from the 'IO' thread. final JobretrieveEncryptionKey(ServiceListener<SharedDeviceSettings> listener)Retrieves the encryption key from the main thread, listener will have the result or the error message. final ServiceResult<SharedDeviceSettings>retrieveEncryptionKey()Retrieves the encryption key from the 'IO' thread. -
Methods inherited from class com.sap.cloud.mobile.foundation.mobileservices.MobileService
enableNetworkPolicy, getApiKey, getApplication, init, isApplicationInitialized, mayStartNewProcess, reset, setApiKey, setApplication -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SharedDeviceService
SharedDeviceService(String applicationKeyParameter, ServiceListener<String> encryptionKeyReadyListener)
-
SharedDeviceService
SharedDeviceService(String applicationKeyParameter)
-
SharedDeviceService
SharedDeviceService()
-
-
Method Detail
-
getEncryptionKeyReadyListener
final ServiceListener<String> getEncryptionKeyReadyListener()
-
onStateChange
Unit onStateChange(ApplicationState state)
Notified when application state changes. This function will be called on Main thread.
-
getCombinedEncryptionKey
final ServiceResult<String> getCombinedEncryptionKey()
Generates a secure encryption key to initialize offline database.
-
retrieveSharedDeviceSettings
final Job retrieveSharedDeviceSettings(ServiceListener<SharedDeviceSettings> listener)
Retrieves the shared device setting from the main thread, listener will contain either the result or the error message
-
retrieveSharedDeviceSettings
final ServiceResult<SharedDeviceSettings> retrieveSharedDeviceSettings()
Retrieves the shared device setting from the 'IO' thread.
-
retrieveEncryptionKey
final Job retrieveEncryptionKey(ServiceListener<SharedDeviceSettings> listener)
Retrieves the encryption key from the main thread, listener will have the result or the error message.
-
retrieveEncryptionKey
final ServiceResult<SharedDeviceSettings> retrieveEncryptionKey()
Retrieves the encryption key from the 'IO' thread.
-
-
-
-