It is not guaranteed that getLine1Number() will always return SIM card's number on all devices. Because the availability of number depends on its storage in the SIM card.
If the number is not stored/available in SIM card then the method will return empty string.
In order to get user's phone number, you should send an sms from user's device to your server or device (same as Viber or other app does). And for a good practice make sure it is done with user's acknowledgement.