EdfaPay Logo

Utility Functions

EdfaPayPlugin.Utils provides helper functions for device identification, location services, secure storage, and UI dialogs. EdfaPayPlugin.Extension provides advanced low-level API access.

Overview

The EdfaPayPlugin.Utils namespace provides helper methods for device identification, location services, secure storage, and UI dialogs.

Device ID

Get unique device identifier for fraud detection and compliance

Location Services

Check and request location permissions; detect GPS mocking

Message Dialog

Show native alert dialogs from the SDK context

Data Storage

Secure key-value storage for SDK data

Device Identification

Get a unique device identifier that is consistent across reinstalls. Optionally scope the ID to a specific merchant.

Loading...

Location Services

Check and request location permissions, retrieve the current device location, and detect GPS mocking.

Loading...

Location Required

The SDK requires location permission for compliance and fraud detection. Transactions may be rejected if location permission is denied.

Message Dialog

Display a native alert dialog using the SDK's context. Useful for showing payment results or error messages to the user.

Loading...

Data Storage

The SDK provides secure key-value storage for persisting SDK-related data between sessions.

MethodDescription
getDeviceId(context)Returns a unique device identifier for the current installation
haveLocationPermission(context)Returns true if location permission is granted
requestLocationPermission(activity)Requests location permission from the user
currentLocationReturns the current device Location object (nullable)
showMessageDialog(activity, title, msg, onOk?)Displays a simple alert dialog with optional OK callback

Device ReadinessNew in v1.0.7

Helpers for making background reconciliation reliable: check and request notification permission (Android 13+), exact-alarm permission (Android 12+), unrestricted battery usage, and OEM autostart allowlisting. Each area has a have/can check, an open-settings helper, and a request method.

MethodDescription
haveNotificationPermission()Returns true if POST_NOTIFICATIONS is granted (Android 13+)
requestNotificationPermission(callback)Requests notification permission; callback receives true if granted
canScheduleExactAlarms()Returns true if the app can schedule exact alarms (Android 12+)
openExactAlarmSettings() / requestExactAlarmPermission(callback)Opens the exact-alarm settings screen / requests the permission
isBatteryUnrestricted()Returns true if the app is exempt from battery optimizations (Doze)
openBatteryUnrestrictedSettings() / requestBatteryUnrestricted(callback)Opens the battery settings screen / requests the exemption
deviceNeedsAutostart()Returns true if this OEM requires an autostart allowlist entry
openAutostartSettings() / requestAutostartPermission(callback)Opens the OEM autostart screen / requests autostart (no-op on stock Android)
Loading...

Why These Matter

Scheduled (background) reconciliation depends on the OS letting the SDK wake up and notify. On aggressive OEMs (Xiaomi, Huawei, etc.) also request autostart; deviceNeedsAutostart() tells you whether the current device requires it — the helpers are no-ops on stock Android.

Extension API (EdfaPayPlugin.Extension)

Low-level API for advanced integration. Access via EdfaPayPlugin.Extension. Provides custom authentication, OTP, and terminal registration.

Loading...

Advanced Use Only

Extension API methods bypass standard initialization flow. Use only if instructed by EdfaPay technical support.

Online ReceiptsNew in v1.0.7

Generate a hosted online receipt URL for a transaction or reconciliation, or open it directly in the device browser. Available under EdfaPayPlugin.Extension. The receipt kind is selected with the ReceiptType enum (TRANSACTION or RECONCILIATION); pass the transaction id or reconciliation id accordingly.

Loading...