Yes. My younger brother did learn programming in a phone. He started in Nokia 2700 Classic, which is not even a smartphone. Then he took a Samsung which runs Android. He certainly didn't become an expert using those devices. But he learnt the basics of Python.
One thing to note probably is, he started very young. And in young ages people can learn very easily. I don't think I can learn programming in a smartphone in my current age. But for kids, whole different game.