using camera on the phone augmented by GPS it is possible to recognize that the user started to cross the road and notify the user (West democracy version) or just turn the screen off for the period of the crossing (authoritarian country version).
Hacking around a lack of personal responsibility is inefficient. Fines are better, and will incentivize these people to pay attention like responsible adults in potentially hazardous areas of public spaces.
sadly on iOS you can't use the camera while the app is in the background. Android might work but probably not without problems too