Unlock app functionality on single device

Hi everyone.
In my app I would like to implement a system for activating certain functions only for devices authorized by me.
Regarding this I was looking for advice.
I thought of a logic where I will manage a txt file in an ftp area in which I write the activated devices.
The app will read this file and if the device is registered then it unlocks the functions.
I was wondering if in your opinion this logic is correct / lawful and if as information of the device I can take the imei code, the serial or other.
I await your advice, thanks.