When setting up an Android phone, the device is signed in to a Google account by default to sync contacts with this account. Deleted contacts will be moved to the Google Contacts trash folder, from which you can restore deleted contacts according to the instructions below.
How to restore contacts on Android
Step 1:
Go to your Google Contacts on your computer or phone and access the Google account you're using on your phone. If you're on your phone, open the Contacts app.
In the Google contacts interface, click on Trash to view deleted phone numbers on your Android phone.

Step 2:
At this time, the user will see the deleted contacts on Android, click on the contact you want to restore to the Android phone.

Step 3:
In the deleted contact information interface, you just need to click Restore to restore deleted contacts on Android.

Contacts will be permanently deleted from the trash after 30 days. Also, if your phone hasn't backed up your contacts, deleted items won't show up here.
How to retrieve deleted numbers on Samsung phones
Recovering deleted contacts on Samsung phones is easier thanks to the recycle bin that stores this information. You have 30 days to recover deleted phone numbers before they are completely deleted.
Step 1:
Go to Settings > Battery and device care > Storage .
Step 2:
In the application interface, click Recycle bin , then select Contacts . Then click on the contact from the list and select Restore .
Step 3
Your phone may save contacts to its internal memory or to your SIM card. Deleted contacts may still be in your backup, so you can import them again.
Tap Contacts > Menu > Manage Contacts.

Then select Import or export contacts and then click on Import . If there are any contacts saved on the SIM card or internal memory, they will be displayed in this interface.
Select the source to import contacts from, then tap Import.
