I want to create an application that will show some predefined message each time I unlock my Windows Phone: before or after i unlock it. If before – then I want to be able to add some text to the lock screen programmatically or as an alternative to change the background image programmatically.
If after – then I want my app running in the background and show a message each time the phone is unlocked.
Please give me some advice or a link if some of this is possible or not?
At this point, it is not possible. There is a uservoice suggestion to allow access to emergency contacts in a locked phone (http://bit.ly/s291DH), but currently it is not possible to do anything to the lock screen.
As far as programmatically altering the lock screen to show a different message before or after lock, if I understand you correctly, this would not be possible. The reason is that an app is not running while the phone is off, with exceptions of apps allowed to run under lock, but they would not run if they are not in the foreground. The background agents could be used, but there is no way to know for sure that an agent will run at a certain time.
There are apps that help you to put emergency contact info on the lock screen, but they do this by placing text over a picture, then save the image, and you have to manually set that altered image as your wallpaper.