com.vodafone360.people
Class MainApplication

java.lang.Object
  extended by Application
      extended by com.vodafone360.people.MainApplication

public class MainApplication
extends Application

Application class used to create the connection to the service and cache state between Activities.


Field Summary
private  ApplicationCache mApplicationCache
           
private  DatabaseHelper mDatabaseHelper
           
private  IPeopleService mServiceInterface
           
private  Handler mServiceLoadedHandler
           
 
Constructor Summary
MainApplication()
           
 
Method Summary
 ApplicationCache getCache()
          Return handle to ApplicationCache.
 DatabaseHelper getDatabase()
          Return handle to DatabaseHelper, currently provides main point of access to People client's database tables.
 PersistSettings.InternetAvail getInternetAvail()
          Retrieve Internet availability setting from People database.
 IPeopleService getServiceInterface()
          Return current IPeopleService interface.
 void onCreate()
          Called when the Application is created.
private  void onServiceLoaded()
           
 void onTerminate()
          Called when the Application is exited.
 void registerServiceLoadHandler(Handler serviceLoadedHandler)
          Register a Handler to receive notification when the People service has loaded.
 void removeUserData()
          Remove all user data from People client, this includes all account information (downloaded contacts, login credentials etc.) and all cached settings.
 ServiceStatus setInternetAvail(PersistSettings.InternetAvail internetAvail)
          Set Internet availability - always makes Internet available, only available in home network, allow manual connection only.
 void setServiceInterface(IPeopleService serviceInterface)
          Set IPeopleService interface - this is the interface by which we interface to People service.
 void unRegisterServiceLoadHandler()
          Un-register People service loading handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mServiceInterface

private IPeopleService mServiceInterface

mServiceLoadedHandler

private Handler mServiceLoadedHandler

mDatabaseHelper

private DatabaseHelper mDatabaseHelper

mApplicationCache

private final ApplicationCache mApplicationCache
Constructor Detail

MainApplication

public MainApplication()
Method Detail

onCreate

public void onCreate()
Called when the Application is created.


onTerminate

public void onTerminate()
Called when the Application is exited.


getDatabase

public DatabaseHelper getDatabase()
Return handle to DatabaseHelper, currently provides main point of access to People client's database tables.

Returns:
Handle to DatabaseHelper.

getCache

public ApplicationCache getCache()
Return handle to ApplicationCache.

Returns:
handle to ApplicationCache.

removeUserData

public void removeUserData()
Remove all user data from People client, this includes all account information (downloaded contacts, login credentials etc.) and all cached settings.


registerServiceLoadHandler

public void registerServiceLoadHandler(Handler serviceLoadedHandler)
Register a Handler to receive notification when the People service has loaded. If mServiceInterface == NULL then this means that the UI is starting before the service has loaded - in this case the UI registers to be notified when the service is loaded using the serviceLoadedHandler. TODO: consider any pitfalls in this situation.

Parameters:
serviceLoadedHandler - Handler that receives notification of service being loaded.

unRegisterServiceLoadHandler

public void unRegisterServiceLoadHandler()
Un-register People service loading handler.


onServiceLoaded

private void onServiceLoaded()

setServiceInterface

public void setServiceInterface(IPeopleService serviceInterface)
Set IPeopleService interface - this is the interface by which we interface to People service.

Parameters:
serviceInterface - IPeopleService handle.

getServiceInterface

public IPeopleService getServiceInterface()
Return current IPeopleService interface. TODO: The case where mServiceInterface = NULL needs to be considered.

Returns:
current IPeopleService interface (can be null).

setInternetAvail

public ServiceStatus setInternetAvail(PersistSettings.InternetAvail internetAvail)
Set Internet availability - always makes Internet available, only available in home network, allow manual connection only. This setting is stored in People database.

Parameters:
internetAvail - Internet availability setting.
Returns:
SerivceStatus indicating whether the Internet availability setting has been successfully updated in the database.

getInternetAvail

public PersistSettings.InternetAvail getInternetAvail()
Retrieve Internet availability setting from People database.

Returns:
current Internet availability setting.


JavaDoc