onServiceCreate

open fun onServiceCreate(context: Context, userActivity: Boolean)

Method to call on your service onCreate to start Batch. You must call this method before any other on Batch. Note that all Batch functionality is not available in this mode. See the documentation for more info. Using this method, you'll also be able to control whether this start should count as user activity or not. This might impact Analytics. Will fail and log an Error if

  • Given context is null
  • You call it before calling start
  • Your app doesn't have android.permission.INTERNET permission

Parameters

context

The service or application context

userActivity

If the start comes from user activity or for background use only