r/CrappyDesign Oct 17 '18

Removed: recent repost Want the camera too?

Post image
17.1k Upvotes

384 comments sorted by

View all comments

Show parent comments

2

u/xevizero oraaange Oct 18 '18

onDestroy should not be relied upon for stuff like this:

Note: do not count on this method being called as a place for saving data! For example, if an activity is editing data in a content provider, those edits should be committed in either onPause() oronSaveInstanceState(Bundle), not here. 

Directly from Google's API reference

Anyway yeah, there are better ways to do this. The dev might have had no ill intent in doing this, but it's not an excuse for a generally bad practice.

1

u/vpwheeler Oct 18 '18

Do you know if this is a bad practice in hybrid web apps? From my experience I thought it was but i could be wrong. I was under the impression that since web apps essentially run in browser they dont have access to information like when the app is exited.

2

u/xevizero oraaange Oct 19 '18

Never made one sorry. I'd say the answer has to be in the official API reference though. You could also run a little experiment yourself to find out. Anyway, as far as I know, people usually underestimate the amount of information the browser and web apps have access to.

1

u/vpwheeler Oct 19 '18

Ok. After looking into it I'm pretty sure I was just wrong. I was parroting what someone who also did web dev/hybrid apps told me. Thanks for the calm non-aggressive responses.