In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
Answering your question, the Fatwa Center at Islam Q and A, states:
The majority of scholars are of the view that it is disliked to enter the toilet with anything in which Allah is mentioned, except in cases of necessity, such as coins on which the name of Allah is inscribed.
A number of scholars stated that if that is hidden, then there is nothing wrong with it in that case.
Ibn Qudamah (may Allah have mercy on him) said:
“If a person wants to enter the toilet and he has with him something in which Allah is mentioned, it is recommended to put it aside.
If he keeps the thing in which Allah is mentioned with him and is careful not to let it fall, or he turns the stone of the ring towards the inside of his palm, there is nothing wrong with that.
Imam Ahmad said:
If a ring has the name of Allah on it and he turns it towards the inside of his palm, and enters the toilet (that is permissible).
He should turn it like this towards the inside of his palm, and fold his fist over it. This was also the view of Ishaq, and the same concession was granted by Ibn al-Musayyib, al-Hasan and Ibn Sireen.
Imam Ahmad said concerning a man who enters the toilet carrying coins: I hope that there is nothing wrong with it. (Al-Mughni, 1/109)
It is permissible to enter the washroom with papers on which is the name of Allah, so long as they are in a pocket and are not out in the open, rather they are hidden and covered. (Fatawa al-Taharah, p. 109)
Based on this, there is nothing wrong with entering the toilet with a mobile phone on whose screen is the phrase “Allahu akbar”, so long as you put it in your pocket, so that it is not out in the open.
Almighty Allah knows best.