---
page_source: https://juspay.io/in/docs/upi-plugin-direct-psp/android/interaction-with-sdk/life-cycle-events
page_title: Life Cycle Events
---


## Life Cycle Events



UPI In-app SDK runs in a fragment. Hence, to handle certain events based upon activity life cycle, client will need to forward those events to the 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


###   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: -

#### Java Code Snippet:

```java
{"success":false,"message":"No Data found for the given path"}
```

#### Kotlin Code Snippet:

```kotlin
{"success":false,"message":"No Data found for the given path"}
```



###   onActivityResult


In order to handle results of App Switches in cases like UPI Intent transactions, you need to call `super.onActivityResult()` if available, if not you can make same function call on HyperServices Instance.

> **Note**
> This is a conditional step, and is only supposed to be implemented if you are **overriding** onActivityResult.





#### Code Snippets: -

#### Java Code Snippet:

```java
{"success":false,"message":"No Data found for the given path"}
```

#### Kotlin Code Snippet:

```kotlin
{"success":false,"message":"No Data found for the given path"}
```



###   onRequestPermissionsResult


In order to handle results of Permission Request results for cases like OTP Reading, you need to call `super.onRequestPermissionsResult()` in your onRequestPermissionsResult lifeCycle hook, if available, if not you can make same function call on HyperServices Instance.

> **Note**
> This is a conditional step, and is only supposed to be implemented if you are **overriding**  onRequestPermissionsResult





#### Code Snippets: -

#### Java Code Snippet:

```java
{"success":false,"message":"No Data found for the given path"}
```

#### Kotlin Code Snippet:

```kotlin
{"success":false,"message":"No Data found for the given path"}
```
