FIX #327: SendWorker now works in the separate process service. - #329
FIX #327: SendWorker now works in the separate process service.#329romansl wants to merge 1 commit into
Conversation
|
Will wait until 4.70 is released before merging this. |
|
Very good but showing notification is something I would avoid. |
|
If a crash occurs on startup (eg in Application.onCreate()) it will enter in a infinite loop because of the Service. |
|
@andryr how does having the service cause an infinite loop? |
|
Each process has its own Application instance. |
|
My solution for this problem: public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
if (!getPackageName().equals(getAppNameByPID(android.os.Process.myPid()))) {
return;
}
ACRA.init(this);
ACRA.getErrorReporter().setReportSender(new HockeySender());
// other initializations...
}
private String getAppNameByPID(int pid){
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for(ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()){
if(processInfo.pid == pid){
return processInfo.processName;
}
}
return "";
}
} |
|
May be this check should be iside |
|
There are some problems with this implementation that need to be addressed. Storing the ReportSender class instead of instance in ErrorReporter means that
Options are
I'm leaning towards the Factory. It's a bigger change in API but that will make people better aware of the change in requirements for a bespoke ReportSender. Thoughts? |
|
Closed in favour of #344 |
This is a basic implementation.
Possible improvements:
SendServiceandSendWorker.SendServiceafter delay.SendService.