Firing a rifle makes a lot of noise but I'm not so sure it would get anyone's attention. It's just too common in the bush. IME most people, especially casual hikers, are not going to investigate who is doing the shooting and why. More the opposite - it tends to signal everyone else to keep clear of the area because you might easily walk into some trigger happy hunter's sights.

Now, shots fired in threes might be different but then you'd need to sacrifice quite a bit of ammunition. Most people who hike in the bush don't carry a firearm and even the ones that do rarely pack lots of ammo.

One other alternative I haven't seen mentioned yet - you can make a surprisingly effective horn from birch bark. Takes some practice and a bit of time but it works.