The only real solution is to campaign for better infrastructure, such as:
- protected bike lanes
- separate bike paths
- Dutch-style raised crossings
What has worked the best for me is taking the lane. If the infrastructure isn't good, ride in the middle of the lane so cars are forced to treat you like a car. Don't use crosswalks or sidewalks, take the place cars are looking for other cars.
Yeah, it'll tick off some drivers, but at least they see me. I'll usually move right every so often if I'm blocking traffic and let the cars past (they'll usually go slowly), then go back to taking the lane. At the end of the day, my life is more important than etiquette. At least I'm my area, it's also legal because I just need to be within 3' (1m) of the edge of the road, which means the rightmost lane market, not the edge of the asphalt, so I can be pretty close to the middle of the lane while following the law, but I will break the law if it keeps my safe.