Package com.tapkey.mobile
Interface TapkeyAppContext
-
public interface TapkeyAppContext
TheApplication
class of an Android app using the Tapkey Mobile SDK must implement this interface. It provides access to the instance ofTapkeyServiceFactory
. Applications usually build theTapkeyServiceFactory
within theApplication.onCreate()
method and hold it as singleton instance. ThegetTapkeyServiceFactory()
method allows accessing it from components like services and broadcast receivers. The example below outlines an Application that implements this interface:public class App extends Application implements TapkeyAppContext { /* * The TapkeyServiceFactory holds all required services. */ private TapkeyServiceFactory tapkeyServiceFactory; @Override public void onCreate() { super.onCreate(); /* * Create an instance of TapkeyServiceFactory. Tapkey expects that a single instance of * TapkeyServiceFactory exists inside an application that can be retrieved via the * Application instance's getTapkeyServiceFactory() method. */ TapkeyServiceFactoryBuilder b = new TapkeyServiceFactoryBuilder(); this.tapkeyServiceFactory = b.build(this); /* * Register the polling scheduler. * The polling scheduler polls for notifications from the Tapkey Trust Service. Note that * the job ID must be unique across the whole app. The default interval is 8 hours. */ PollingScheduler.register(this, 1, PollingScheduler.DEFAULT_INTERVAL); } @Override public TapkeyServiceFactory getTapkeyServiceFactory() { return tapkeyServiceFactory; } }
- See Also:
TapkeyServiceFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TapkeyServiceFactory
getTapkeyServiceFactory()
Returns the singleton instance ofTapkeyServiceFactory
.
-
-
-
Method Detail
-
getTapkeyServiceFactory
TapkeyServiceFactory getTapkeyServiceFactory()
Returns the singleton instance ofTapkeyServiceFactory
.- Returns:
- the instance of
TapkeyServiceFactory
-
-