Как сказал выше subpider, передайте контекст в класс, и все будет в порядке:
public class DoSomethingClass {
//Here's a context
private Context _CONTEXT;
//Construct that sets the context
public DoSomethingClass(Context c) {
this._CONTEXT = c;
}
public void createNotification() {
/*
Create the notification as usual, just make sure you alter the following lines:
Intent notificationIntent = new Intent(this, MyClass.class);
Context context = this.getApplicationContext();
^Make sure you alter this into this._CONTEXT above
*/
}
}