Answer:
Both in the wild and in captivity, noise is their best option. A lot of primates will display, beating their chest (like in gorillas), screaming (like in the chimpanzees) and hooting (like in the gibbons). In captivity, they shake the wire of their enclosures, slam doors, smack plastic drums (that is why such things are in their enclosures!), and vocalise. Typically in captivity, the 'scaring' is directed towards the public however, but since humans are apes, and they usually look scared, it seems to work from the caged animal's perspective!