How to lock iPhone and Android when pushed power button Android/iOS?

Hi there.

If I push power button of iPhone/Android, the device turn off.
And What I’d like to do is locking screen.

Is it able without plugin?

When you press the power button? This is already done by the device, pressing the power button on iOS or android will already turn the screen off, if that locks the screen or not is based on the users settings for the device, I do not believe you have (or should have) access to that setting in your game.