System Hooks - The Vapor Android Framework
System Hooks are created using the Vapor Hook Framework; they provide you with a way to register for notifications when a particular event occurs during the life time of your Android application.
Read the Vapor Hook Framework section for details on how you can create your own hooks specific to the Android app you are developing.
This section will briefly explain the current list of System Hooks, and when you might want to use them.
VaporActivity
The following hooks pertain to Vapor Activity
VaporActivity.CREATE
Fired everytime .create(VaporBundle) is called upon a VaporActivity, AFTER .create(VaporBundle) is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.START
Fired everytime .start() is called upon a VaporActivity,
AFTER .start() is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.PAUSE
Fired everytime .pause() is called upon a VaporActivity,
AFTER .pause() is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.RESUME
Fired everytime .resume() is called upon a VaporActivity,
AFTER .resume() is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.STOP
Fired everytime .stop() is called upon a VaporActivity,
AFTER .stop() is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.PAUSE
Fired everytime .pause() is called upon a VaporActivity,
AFTER .pause() is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.RESTART
Fired everytime .restart() is called upon a VaporActivity,
AFTER .restart() is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.DESTROY
Fired everytime .destroy() is called upon a VaporActivity,
AFTER .destroy() is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.VIEW_READY
Fired once when the geometry of a VaporActivity's layout has been fully measured and calculated
Hook Args
| Key | Value | Description |
|---|---|---|
| "activityClass" | Class<? extends VaporActivity> | The class of the VaporActivity that fired the hook |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.SERVICE_BIND
Fired everytime a Service is bound to a VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "serviceName" | ComponentName | The ComponentName that pertains to the newly bound service |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.SERVICE_UNBIND
Fired everytime a Service is unbound from a VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "serviceName" | ComponentName | The ComponentName that pertains to the unbound Service |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.CONFIG_CHANGED
Fired whenever the .onConfigurationChanged(Configuration) event is raised on the current VaporActivity context
Hook Args
| Key | Value | Description |
|---|---|---|
| "newConfig" | Configuration | The new configuration |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.LOW_MEM
Fired whenever the .onLowMemory() event is raised on the current VaporActivity context
Hook Args
None
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.ORIENTATION
Fired whenever the device orientation changes
Hook Args
| Key | Value | Description |
|---|---|---|
| "orientation" | int | An integer representing the current orientation, as per the standard Android specification |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.ORIENTATION_PORTRAIT
Fired straight after VaporActivity.ORIENTATION, iff the current orientation is portrait
Hook Args
None
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.ORIENTATION_LANDSCAPE
Fired straight after VaporActivity.ORIENTATION, iff the current orientation is landscape
Hook Args
None
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.DEVICE_TABLET
Fired as the last action of the .create(VaporBundle) callback upon a VaporActivity,
iff Vapor determines the user's device to be a tablet. This hook is fired AFTER .create(VaporBundle) is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "displayWidth" | int | The width of the device display |
| "displayHeight" | int | The height of the device display |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporActivity.DEVICE_PHONE
Fired as the last action of the .create(VaporBundle) callback upon a VaporActivity,
iff Vapor determines the user's device to be a phone. This hook is fired AFTER .create(VaporBundle) is invoked on your derived VaporActivity
Hook Args
| Key | Value | Description |
|---|---|---|
| "displayWidth" | int | The width of the device display |
| "displayHeight" | int | The height of the device display |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporService
The following hooks pertain to Vapor Service
VaporService.SERVICE_EVENT
Fired whenever a Service is bound to a client, or unbound from a client
Hook Args
| Key | Value | Description |
|---|---|---|
| "serviceName" | ComponentName | The name of the Service |
| "bound" | boolean | Flag that will be true iff the Service has been bound, false if it has been unbound |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
$
The following hooks pertain to the central $ facade
$.CONTEXT_CHANGED
Fired whenever the implicit Context handle changes
Hook Args
| Key | Value | Description |
|---|---|---|
| "oldContext" | String | A short name for the previous Context's class |
| "newContext" | String | A short name for the new Context's class |
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0
VaporSharedPreferences
The following hooks pertain to Vapor SharedPreferences
VaporSharedPreferences.COMMIT_FAILURE
Fired whenever a commit operation on VaporSharedPreferences fails.
Commit failure only occurs if .async(false) is set on the VaporSharedPreferences
Hook Args
None
- Admin Auth
true- Subscriber Auth
false- Since
- 1.0

