encorej / acra

Automatically exported from code.google.com/p/acra
0 stars 0 forks source link

Enhancement (With Diff): Passing the Context to a Custom Sender #113

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Essentially, I have a Custom Report Sender and it needs the Android Context to 
be able to do everything that I need to do. Most specifically, I send data to a 
Server and I want to save the response. I cannot persist data on an Android 
device without a Context. You seem to have realised that Context's are useful 
in your EmailIntentSender class because you passed it the Context in the 
constructor; you use it to send get the package name and start the email 
intent. So there are very valid use cases for needing the Context in a 
ReportSender. 

Therefore I hope you will consider adding this patch to the ACRA codebase for 
it would be incredibly helpful in my current project. The patch passes Context 
in to ReportSender's via the send function. Thankyou for your time and thank 
you for all of your hard work and effort on the ACRA project. I use it in my 
game and will use it in my future projects.

Original issue reported on code.google.com by robertma...@gmail.com on 15 Feb 2012 at 6:59

Attachments:

GoogleCodeExporter commented 8 years ago
Why wouldn't you implement your sender the same way as the EmailIntentSender 
and pass your Application Context when you create the instance before providing 
it to ACRA ?

Original comment by kevin.gaudin on 5 Mar 2012 at 9:45

GoogleCodeExporter commented 8 years ago
Mainly because I did not think of it for some reason, that works just as well I 
guess. I suppose that I figured that I would trust ACRA to handle the Context 
properly and release the object when required rather than trust the end user; I 
have a strong desire not to leak the Context object but I suppose that you 
cannot really leak the Application context in the same way that you can leak 
Activity contexts. So this works just as well and that is what I will do; 
thanks for your time.

Original comment by robertma...@gmail.com on 5 Mar 2012 at 10:22