Use a safe where possible, most hotels have them in their rooms, but not sure about rented apartments/villas.
Some developments provide security guards over night or 24hr, which you will contribute as part of the service charge (if you buy one of the apartments there).
Whether you are in an apartment or somewhere without security, there are opportunists may be about and if you leave windows or doors open, whether you are in it at the time or not, some may try and enter your property.
If buying on a secure complex, check the service charges as they will be higher if you have security.
Some people prefer ground floor apartments, but then take additional security measures on doors and windows. First and second floor apartments can also be targeted by opportunists if there is easy access to a balcony or via the staircase.