iMessage Waiting for Activation Error

When I upgraded to the latest iPhone, all my settings and apps were easily transferred from my old phone using iCloud backup. I signed into a few accounts and quickly started using all my favorite apps. When I went to send a text message from the Messages app, the message sent as a text message instead of sending as an iMessage, even though the recipient also had an iPhone. After trying another message with the same result, I went to Settings > Messages to see if iMessage was disabled for some reason.
What I found was a message that said iMessage was Waiting for Activation.
waiting for activation
I tried re-entering my Apple ID and password with no luck. The login seemed to get stuck and another test message went as an SMS message instead of as an iMessage.
After checking some other settings, like verifying that my phone was properly connected to the network, I ultimately had to follow the set of steps below in order to finally make iMessage work.
1. Go to Settings > Messages and turn off iMessage.
2. Go to Settings > FaceTime and turn off FaceTime.
The reason you turn both off is they are typically linked in this activation issue. When one doesn’t work, the other one generally doesn’t either.
3. Restart your iPhone (or iPad if you have this problem on an iPad).
4. Turn iMessage back on in Settings > Messages.
5. Turn FaceTime back on in Settings > FaceTime.
At this point, if you need to enter your Apple ID and password again, both iMessage and FaceTime should be active and able to send and receive as expected.