Update connection to use cordova events

cc @rwmtse