Support truncating alert message when too long

Also take max payload length as a parameter rather than hard-coding
it. Apple is raising the limit to 2048 with iOS 8.