With that out of the way...
Carrot or stick. School is already all stick all the time. Right now, some students feel that some of their time is better spent on their phones than paying attention to the teacher. Why that is doesn't seem to be a significant part of the conversation.
Properly fund public, free for everyone education. Pay teachers more. Make school good for kids instead of trying to force kids to be good for school.