Based on this link I added the events to handle memory during background execution. MemoryManager.AppMemoryUsageLimitChanging event fires on app launch. But while moving the app to background and bringing to foreground again, the event doesn't seem to fire. However, OnSuspending is firing for me.
I tried out the sample here which fires the events correctly. But I could not find out any difference from this app to mine. Is there anything extra I should do to get these events correctly?
Also, one point I noticed is that, if I comment out the MainPage UI in the sample above, the events fail to fire there too!