---
page_title: 7. Life Cycle Events
product: EC Headless
platform: Capacitor
page_source: https://juspay.io/in/docs/ec-headless/capacitor/base-sdk-integration/life-cycle-events
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/ec-headless/llms.txt
---


## 7. Life Cycle Events



Express Checkout SDK runs in a fragment. Hence, to handle certain events based upon activity life cycle, client will need to forward those events to Express Checkout SDK.

These events are crucial for seamless functioning of features like OTP reading, App Switches (UPI Intent), Hardware backpress.

Following are the Life cycle events which SDK needs


### Step 7.1. onBackPressed


In order to handle hardware backpress done by user, you have to call `onBackPressed()` on HyperServices Instance in the onBackPressed function of your Checkout Activity.

onBackPressed function returns a boolean. When this return value is true hardware backpressed is consumed by Juspay SDK, if its false you need to handle backpress



#### Code Snippets: -

#### Capacitor Code Snippet:

```capacitor
{"success":false,"message":"Failed to fetch snippet"}
```


---

## Complete Code Reference

The following code files are referenced in the steps above:

### payment_page.js

```
{"success":false,"message":"Failed to fetch snippet"}
```


---

## See Also

- [6. Handling Payment Response](https://juspay.io/in/docs/ec-headless/capacitor/base-sdk-integration/handling-payment-response)
- [Get Customer API](https://juspay.io/in/docs/ec-headless/capacitor/base-sdk-integration/getcustomer)
