Artenus 2D Framework
Artenus Reference
Provides store-specific game functionality in a unified way. In-app billing, ad management, and game services are handled by this class.
public abstract class UnifiedServices

Field Summary

Modifier and TypeField and Description
public static final SERVICE_ADS
Service flag for ads
public static final SERVICE_BILLING
Service flag for in-app billing
public static final SERVICE_GAMES
Service flag for game services

Constructor Summary

Modifier and TypeConstructor and Description
protected UnifiedServices()
Called by subclasses to construct an empty instance of UnifiedServices.

Method Summary

Modifier and TypeMethod and Description
public abstract AdManagergetAdManager()
Gets an instance of AdManager provided by this implementation.
public abstract GameServicesgetGameServices()
Gets an instance of GameServices provided by this implementation.
public static UnifiedServicesgetInstance(int services)
Gets the current instance of UnifiedServices.
public static UnifiedServicesgetInstance()
Gets the current instance of UnifiedServices.
public abstract InventoryManagergetInventoryManager()
Gets an instance of InventoryManager provided by this implementation.
public abstract LoginManagergetLoginManager()
Gets an instance of LoginManager provided by this implementation.
public abstract StoresgetStore()
Gets the app-store this instance operates in
public final booleanhasServices(int servicesMask)
Checks if this instance supports specified services.
protected abstract intinit(int inputServices)
Called on sub-classes to initialize the services, and mask out those they do not support.
public booleanonActivityResult(int requestCode, int resultCode, Intent data)
public abstract voidonCreate(Context context)
Called internally as part of onCreate(Bundle).
public abstract voidonDestroy(Context context)
Called internally as part of onCreate(Bundle).
public voidonPause()
Called internally as part of onPause().
public voidonResume()
Called internally as part of onResume().
public voidonStart()
Called internally as part of onStart().
public voidonStop()
Called internally as part of onStop().

Methods inherited from java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

SERVICE_ADS
public static final SERVICE_ADS
Service flag for ads
SERVICE_BILLING
public static final SERVICE_BILLING
Service flag for in-app billing
SERVICE_GAMES
public static final SERVICE_GAMES
Service flag for game services

Constructor Detail

UnifiedServices
protected  UnifiedServices()
Called by subclasses to construct an empty instance of UnifiedServices.

Method Detail

getAdManager
public abstract AdManager getAdManager()
Gets an instance of AdManager provided by this implementation.
Returns:
Ad manager instance, or null if ads are not supported
getGameServices
public abstract GameServices getGameServices()
Gets an instance of GameServices provided by this implementation.
Returns:
Game services instance, or null if not supported
getInstance
public static UnifiedServices getInstance(
    int services
)
Gets the current instance of UnifiedServices. If no such instance exists, a new instance will be created, supporting services specified.
Parameters:
servicesThe bit-masked list of services.
Returns:
Current instance
getInstance
public static UnifiedServices getInstance()
Gets the current instance of UnifiedServices.
Returns:
Current instance, or null if it is not yet created
getInventoryManager
public abstract InventoryManager getInventoryManager()
Gets an instance of InventoryManager provided by this implementation.
Returns:
In-app billing manager instance, or null if not supported
getLoginManager
public abstract LoginManager getLoginManager()
Gets an instance of LoginManager provided by this implementation. The returned value is never null.
Returns:
Login manager instance
getStore
public abstract Stores getStore()
Gets the app-store this instance operates in
Returns:
The store
See Also:
hasServices
public final boolean hasServices(
    int servicesMask
)
Checks if this instance supports specified services. These might be different than those provided in getInstance(int), as implementations mask out services they do not support.
Parameters:
servicesMaskBit-masked list of services
Returns:
true if specified services are available, false otherwise
init
protected abstract int init(
    int inputServices
)
Called on sub-classes to initialize the services, and mask out those they do not support.
Parameters:
inputServicesBit-masked list of requested services
Returns:
Bit-masked list of requested services supported by the specific implementation
onActivityResult
public boolean onActivityResult(
    int requestCode,
    int resultCode,
    Intent data
)
Called internally by onActivityResult(int, int, Intent). Unified services implementations direct it to their sub-services to handle their own activity requests.
Parameters:
requestCodeThe integer request code
resultCodeThe integer result code returned by the child activity
dataAn Intent, which can return result data to the caller
Returns:
true if handled, false otherwise
onCreate
public abstract void onCreate(
    Context context
)
Called internally as part of onCreate(Bundle).
Parameters:
contextArtenus context
onDestroy
public abstract void onDestroy(
    Context context
)
Called internally as part of onCreate(Bundle).
Parameters:
contextArtenus context
onPause
public void onPause()
Called internally as part of onPause().
onResume
public void onResume()
Called internally as part of onResume().
onStart
public void onStart()
Called internally as part of onStart().
onStop
public void onStop()
Called internally as part of onStop().