shouldSkipAppInitialize

@JvmStatic
@JvmName(name = "shouldSkipAppInitialize")
fun shouldSkipAppInitialize(context: Context): Boolean

Checks if the current process is the dedicated process for the In-Person Payments SDK.

The SDK operates in a separate :ipp process from the main application. Because Android instantiates the android.app.Application class once per process, Application.onCreate() is called both in the main process and in the :ipp process. This helper allows you to guard application-specific initializations so they only run in the main process.

Why this matters

When the :ipp process starts, any work performed in Application.onCreate() delays the moment the SDK's bound android.app.Service can respond to the client. The following are common sources of delay:

  • Third-party libraries — analytics SDKs, crash reporters, dependency-injection frameworks, and other libraries that initialize eagerly in onCreate (or via androidx.startup) will run a second time in the :ipp process, consuming CPU and memory.

  • Main-thread contentionandroid.content.ServiceConnection.onServiceConnected is dispatched on the main thread. Heavy onCreate work blocks the main looper and delays this callback, which in turn delays every IPC call that is waiting for the connection.

  • Binding timeout risk — if the combined startup work exceeds the IPC binding timeout, the SDK will report a binding failure to the merchant even though the service would eventually become available.

Using this guard is the single most effective way to reduce :ipp process startup time and avoid spurious timeout failures on slower or resource-constrained devices.

Recommendation for third-party libraries

Many third-party libraries (e.g. Firebase, Sentry, Koin) use androidx.startup.Initializer or ContentProvider-based auto-initialization, which means they start automatically in every process — including the :ipp process — without any explicit call from the application. To prevent this unnecessary resource consumption:

  1. Disable automatic initialization for each library by removing or overriding its <provider> entry in the AndroidManifest.xml (see the library's documentation for the exact steps).

  2. Initialize the library manually inside the guard provided by this method, so it only runs in the main process.

Example:

class MyApp : Application() {

override fun onCreate() {
super.onCreate()

if (InPersonPaymentsTools.shouldSkipAppInitialize(this)) {
// Skip main app initializations if we are in the SDK's process.
return
}

// Proceed with regular application initialization — only in the main process.
initializeMyAnalytics() // manually initialized after disabling auto-init
initializeMyDependencyInjection()
}
}

Return

true if the current process is the In-Person Payments SDK process and main app initializations should be skipped; false otherwise.

Parameters

context

The application context.