You have just lost. Denying yourself something is not a viable way to avoid it. (Don't think about elephants.)
There are only two solutions here. Either become someone else, change yourself so that you do not crave it any more, or displace it with something else.
If you want to be fit, or at least less flabby, the psychologically viable route is to tell yourself "I am the kind of person who does 50 pushups after getting out of bed in the morning." Or, "I am the kind of person who cooks his own low-carb meals." And then actually become that person.
If you don't want to stare at your phone in a public place, displace that behaviour with something else. "Instead of mindlessly browsing HN, I'll go talk to that cute chick at the end of the bar." Or even just "I will meditate, I will think about nothing but my breathing while waiting for that coffee." Though that might be even weirder than playing with your smartphone.