I feel like with most things with kids, you just talk to them honestly and openly about things. I feel like, if they're old enough to ask, they're probably old enough to hear the answer.
This way they feel more comfortable asking you things. Because even if you lock down their devices air tight, they're friends parents probably didn't do the same. You can't protect your kids from the world but, you can prepare them to face it.