Typically, even if the police have a warrant to search your home or apartment, they're going to knock first before they attempt to come in. They may show you the warrant to demonstrate that you can't refuse the request, but you still open the door for them and have some idea of what's going on.
However, U.S. law does allow officers to get no-knock warrants, which mean they can lawfully enter your residence without talking to you first or alerting you to their presence. The first indication that a warrant is being executed that you may have comes when they break open the door and enter your living space.
Even though these are legal, they're generally just used in a few different situations, one of which is if the police believe you may destroy evidence if they knock. For example, if they think you have drugs in the apartment, they may be concerned that knocking on the door will just give you time to flush them down the toilet or burn them in the fireplace. They want to come in before you have time to act so they can secure this evidence.
These warrants may also be used if there is an established risk for the officers that could lead to serious harm or death. For instance, if the officers are chasing a suspect who is believed to be armed and dangerous, they'll be concerned that knocking on the door will just start a potentially deadly exchange of gunfire. The no-knock warrant could be used to help reduce the risk with the element of surprise.
Of course, the legality of these warrants does not give officers the right to break in unannounced in all situations or without warrants. They must take the proper steps to respect your rights. If you feel these rights have been violated by officers acting outside of the law, you need to know how this impacts your defense options in California.
Source: Department of Justice, "Authority of Federal Judges and Magistrates to Issue "No-Knock" Warrants," accessed Aug. 16, 2016