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?
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?
The new API states this:
BugSenseHandler.initAndStartSession(MyService.this, "MY_API_KEY");
But pretty much the same as what jelies said in his answer
Don't forget about these as well:
Whenever you want to explicitly start the session, you can use the startSession method at the onStart method of your activity, as follows:
BugSenseHandler.startSession(MyService.this);
Whenever you want to close the session, you can use the closeSession method as follows:
BugSenseHandler.closeSession(MyService.this)
If you want to manually flush all the saved data, use the BugSenseHandler.flush(Context) method:
BugSenseHandler.flush(MyService.this);
Full doc for Bugsense is here: https://www.bugsense.com/docs/android You can apply this same logic to the service.
context
is your main activity or your service. Initialize BugSense callingBugSenseHandler.setup()
withthis
.