UnifiedPush: Use metadata object as argument in registerWithPushServer, more error checking and add JSDoc