Awareness is 90% of the battle. Just being aware of where you are, what you’re doing, and who’s around you will keep you safe. In my city, and others like NY, I’m always shocked at tourists who are just so blatently tourists. Stopped on the sidewalk, pointing up at the big buildings, completely unaware of the world outside of them. Not only is it incredibly inconsiderate to the people around you, but it makes you an easy target.
The rest for me is confidence. I used to get nervous when I saw a large group of people that I’d have to walk through/around, but now it’s just a normal thing. Just confidently walk past them, don’t look at them, just keep going, and I’ve never been hassled. Hell I’ve had to literally step over people sitting on the ground before, just don’t look like you’re nervous and it’ll go well. If you go out expecting something to go wrong, it probably will. If you look like you go there a million times, no one will care.
Cities really have gotten safer, it’s pretty safe to just walk down any street now in most cities. Just don’t be an idiot walking around looking like you don’t belong offering an easy score.