public final class MobileBackendManager
extends java.lang.Object
try { MobileBackend mobileBackend = MobileBackendManager.getManager().getDefaultMobileBackend(MainActivity.this); } catch (ServiceProxyException e) { Log.i("Authorization", e.getMessage()); }
Once the singleton and mobile backend is derived, it will then use this to access other services provided by the SDK such as this example to authenticate the mobile user anonymously against MCS:try { MobileBackend mobileBackend = MobileBackendManager.getManager().getDefaultMobileBackend(MainActivity.this); mobileBackend.getAuthorization().authenticateAnonymous(MainActivity.this, new AuthorizationCallback() { @Override public void onCompletion(ServiceProxyException exception) { if (exception != null) { Log.i("Authorization", exception.getMessage()); } else { Log.i("Authorization", "Authentication Successful."); } } }); } catch (ServiceProxyException e) { Log.i("Authorization", e.getMessage()); }
If more than one mobile backend is defined in the oracle_mobile_cloud_config.xml file, the getMobileBackend method supplying the mobile backend name as a string can be used instead:try { MobileBackend mobileBackend = MobileBackendManager.getManager().getMobileBackend(MainActivity.this,"back_end_name");; } catch (ServiceProxyException e) { Log.i("Authorization", e.getMessage()); }
Modifier and Type | Method and Description |
---|---|
MobileBackend |
addMobileBackend(Context context,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> properties)
Adds a new mobile backend
|
MobileBackend |
getDefaultMobileBackend(Context context)
Returns the default mobile backend.
|
MobileBackend |
getDefaultMobileBackend(Context context,
java.util.Map<java.lang.String,java.lang.String> properties)
Returns the default mobile backend with overridden properties specified in properties map.
|
static MobileBackendManager |
getManager()
Returns the mobile backend manager
|
MobileBackend |
getMobileBackend(Context context,
java.lang.String name)
Returns the specified mobile backend.
|
MobileBackend |
getMobileBackend(Context context,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> properties)
Returns the specified mobile backend with overridden properties specified in properties map.
|
public static MobileBackendManager getManager()
public MobileBackend getDefaultMobileBackend(Context context) throws ServiceProxyException
context
- current contextServiceProxyException
- if supplied context is null or there is no default backend
or there is an error in parsing the config filepublic MobileBackend getDefaultMobileBackend(Context context, java.util.Map<java.lang.String,java.lang.String> properties) throws ServiceProxyException
context
- current contextproperties
- mobile backend map containing properties to be overriddenServiceProxyException
- if the supplied context is null or there is no default backend
or there is an error in parsing the config file.public MobileBackend getMobileBackend(Context context, java.lang.String name) throws ServiceProxyException
context
- current contextname
- the mobile backend nameServiceProxyException
- if supplied context is null or there is no backend with
the supplied name or there is an error in parsing the config file.public MobileBackend getMobileBackend(Context context, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties) throws ServiceProxyException
context
- current contextname
- The mobile backend nameproperties
- mobile backend map containing properties to be overriddenServiceProxyException
- if supplied context is null or there is no backend with
the supplied name or there is an error in parsing the config file.public MobileBackend addMobileBackend(Context context, java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties) throws ServiceProxyException
context
- current contextname
- mobile backend nameproperties
- mobile backend propertiesServiceProxyException
- if supplied context is null or supplied backend name is null
or there is an error in parsing the config file