new c2dm api support

current implementation only support the deprecated c2dm.
you can switch between api's with the 'legacymode' flag in the config object