Please call DeleteLocalRef() on cActivity after this line because you don't need it anymore. Actually deleting the cActivity reference is missing altogether.

Same applies for SetSystemVolume().