I wrote programs on my calculator in high school, an ostensibly narrowly focused device with computing power generously estimated at well under 1% that of your phone, made by a company that didn't really give two shits about their device's programming community.
Therefore, it's hard not to come to the conclusion that if someone as dedicated as you is struggling to write programs for your phone, on your phone, it's because you're being actively discouraged from doing so. Demand better! As a consumer the only voice you have is your wallet. Can you not find a real computer that's comfortable to use in bed?