[TIMOB-17231][TIMOB-17232] Fixing issues with sending out analytics events

Following test case in Related JIRA 

* [NATIVESDK-214](https://jira.appcelerator.org/browse/NATIVESDK-214) Sending of background events
* [NATIVESDK-212](https://jira.appcelerator.org/browse/NATIVESDK-212) Generation of new session id and invalid background events.