fixes #5302 use new activity lifecycle callbacks instead of the deprecated events