I have a live wallpaper that crashes from time to time, and I would like to harvest the benefits of integrating ACRA (http://code.google.com/p/acra/) for generating and collecting crashreports in a google spreadsheet.
However I just couldn’t integrate ACRA in my live wallpaper. Here is what I tried so far:
- Followed the basic setup guide (http://code.google.com/p/acra/wiki/BasicSetup)
- Initialized ACRA with
ACRA.init(WallpaperService.getApplication());inWallpaperService.onCreate() - Annotated WallpaperService with
@ReportsCrashes(formKey = "dFhXY3Y4N2NXXXXXXXXwM1g3Z1FZUVE6MQ", mode = ReportingInteractionMode.TOAST, forceCloseDialogAfterToast = false, resToastText = R.string.crash_text_toast)
When I build and deploy the app, it just crashes like before, and ACRA is not enabled.
It seems the problem stems from the fact that ACRA expects a subclass of Application to be annotated.
I am compiling my app for android 2.1-update and using latest version of ACRA (4.23 as of now), and running on a phone with android 2.3.4.
Any help is more than welcome!
I missed the basic fact that Android Live Wallpapers can have an optional class extending android.app.Application referenced from its AndroidManifest.xml.
Using this class is the best way to include ACRA in your wallpaper because it allows ACRA to start at the earliest possible moment in the lifecycle of your wallpaper.
Simply create a class extending android.app.Application in your project and name it from the android:name attribute in the application element of your manifest. Example.
In your manifest:
In MyApplication.java: