I have a great gadget called a "Scarecrow sprinkler" that has an electric eye and an impulse sprinkler that sends a strong 3 second burst of water each time the electric eye is triggered.
https://www.amazon.com/dp/B0001A9TDS/
It works in the front yard outside the fence to guard my lychees, but the tree gets watered quite a bit if it is windy and the leaf movement triggers the sprinkler. Even works at night, against the raccoons and rats.
In the back yard, every time I've set it out to guard the mango tree, the cat comes in wet and angry. We're lucky here, no coyotes and our yard has a 6ft. fence all around which deters other predators, too. So my issues are with squirrels and raccoons stealing my wonderful mangoes. In the daytime I patrol the yard regularly, and this deters the squirrels quite a bit, but at night not much you can do to prevent a raccoon short of trapping them.