It is suggested to maintain a time of 5 seconds or above in between initiate and process. Occasionally this may not be possible within the same Activity. This brings up the use case to call initiate and process from different activities. The SDK takes an Activity and viewGroup as input in the constructor of HyperServices. This activity and view group is used for any UI / context requiring functionality in the SDK. To integrate the SDK across multiple activities the activity and view group must be updated in SDK API. All SDK APIs support overriding the activity and view group.
ViewGroup and activity passed to the process API is not specific to that process, but modifies the viewGroup for all future process calls.
// If you require the sdk to take up the entire screen, // please follow the other tab hyper.initiate((FragmentActivity)activity, (ViewGroup)view, initiatePayload, hyperPaymentsCallback); hyper.process((FragmentActivity)activity, (ViewGroup)view, processPayload);
// If you require to specify the view group the sdk uses, // please follow the other tab hyper.initiate((FragmentActivity)activity, initiatePayload, hyperPaymentsCallback); hyper.process((FragmentActivity)activity, processPayload);
While integrating across multiple activities, be sure to pass activity in all SDK APIs.
The SDK holds a reference to the activity and view group. While using the SDK across multiple activities, the Android system may destroy older activities. If that was the last activity passed to the SDK, this can create a memory leak.
In order to avoid memory leaks, developers must ensure to call resetActivity function of the HyperServices object, while switching activities. This will ensure that SDK does not hold onto the activity and viewGroup passed to the SDK.
After calling resetActivity, the next process must pass activity as an argument, else this may result in a crash.
Updated 4 months ago