Ensure that ActivityManager is constructed with a non-null context.

Fixes issue #785