Ionic Ionicplatform
# Ionic Platform
* * *
## $ionicPlatform
$ionicPlatform is used to detect the current platform, and to override the Android back button in PhoneGap/Cordova, for example.
### Methods
onHardwareBackButton(callback)
On platforms with a hardware back button, you can bind to it using this method.
| Parameter | Type | Details |
| --- | --- | --- |
| callback | `function` | Callback function triggered when the event occurs. |
offHardwareBackButton(callback)
Removes the listener for the back button.
| Parameter | Type | Details |
| --- | --- | --- |
| callback | `function` | The monitor function originally bound. |
registerBackButtonAction(callback, priority, )
Registers an action for the hardware back button. When the button is clicked, only one action will execute, so this method determines which registered back button action has the highest priority.
For example, if an action sheet is already displayed, the back button should close the action sheet instead of going back a view or closing an open modal.
| Parameter | Type | Details |
| --- | --- | --- |
| callback | `function` | Triggered when the back button is clicked, if this monitor has the highest priority. |
| priority | `number` | Only the highest priority will execute. |
| actionId _(Optional)_ | `*` | Specifies the ID for this action. Default: a random and unique ID. |
**Returns:** Function, a function that will be triggered to unregister the backButtonAction.
ready()
Triggers a callback function when the device is ready.
| Parameter | Type | Details |
| --- | --- | --- |
| callback _(Optional)_ | `function=` | The function to trigger. |
Returns: Promise object, resolved upon successful construction.
YouTip