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.
Merge branch '6435/truncate_alert'

* 6435/truncate_alert:
  Support truncating alert message when too long