Added notifications to the PW app plus some code refactoring

The two DeviceManagerForApp and ForService classes are nearly identical. Can you find a way to reuse some of this code? Why do we even need two copies of it?