My niece cannot unlock her Samsung s4, is there a way to retrieve the passcode without loosing her pictures and music?
Unless the phone asks at some point (before factory reset) for a Google log in entry, a factory reset might be inevitable.
If the phone has the Google Device Manager enabled, you can use the "Lost Phone" feature of the Google Device Manager to set a lock password on the phone. This assumes that the phone actually has data either via Wi-Fi or mobile data, and the device manager is actually enabled as a device administrator on the device.
To use:
Visit https://www.google.com/android/devicemanager?u=0
Have your Niece log into the Google account she uses on that phone for the Play Store, Google Hangouts App, etc.
Select the Device from the list of devices, if there are multiple listed.
Click the "Lock" button.
Google will ask to set a password. Set something that can be used to unlock the phone simply.
Wait about a minute. When you check the phone, it should be asking for a password.
Unlock the phone using this newly set password.
The ADM trick doesn't work. It will lock the phone, but you still have to use the saved PW/PIN as before.
I guess I should have asked. Did the phone have a Password or a PIN on it before? The password is set by Google to replace the PIN if the phone is PIN Secured.