It's not good advice if you are an individual who just wants to avoid the inside of a prison cell, and it's definitely dangerous, but I'd still admire anyone with the strength of character to follow through with it.
It's also terrible advice in countries where the preferred solution is simply to murder loud activists. At least you can theoretically be released from prison.
I'm less sure about an individual reading that advice and swearing at a border guard. Both Ghandi and MLK used mass resistance to achieve their ends.
If you're an American returning from abroad, my understanding is the most they can do is detain you (briefly) and confiscate your electronic devices for a limited period of time. Americans can't be denied re-entry to the US. So go ahead and refuse as a political statement, the worst that could happen is you'll miss your connection and you'll have to use a temporary phone for a bit.
But if you're a foreign citizen, it's probably best to swallow your pride and comply.
Detentions have lasted more than 24 hours though, sometimes for days:
"Median Number of Hours Individuals Were Held in Detention, by Sector"