androidandroid-servicebugsense

Bugsense on Android service


Following Bugsense docs I've found that I need to add this code on Service onCreate:

BugSenseHandler.setup(context, "MY_API_KEY");

What it is that context variable? Do I need to pass main Activity reference to service constructor?


Solution

  • context is your main activity or your service. Initialize BugSense calling BugSenseHandler.setup() with this.

    public class MyService extends Service {
        ...
        @Override
        public void onCreate() {
            ...
            BugSenseHandler.setup(this, "MY_API_KEY");
            ...
        }
    }