document.addEventListener event resume provider undefined

I have to listen to the resume event and to do so I’ve to subscribe to the document (this.platform.resume doesn’t work in this case, full story https://forum.ionicframework.com/t/camera-plugin-restart-app-on-android-8-1)

Unfortunately doing so, I could properly catch the event but in the method I want to use/call, the providers are undefined

Do I code something wrong? Do you see any mistake in my code? Any idea how to solve this?

I would need the provider in the method called by the resume event, because of course, I’ve to process the result…

Thx in advance for the help

constructor(private platform: Platform, public myService: MyService) {
    platform.ready().then(() => {
       document.addEventListener('resume', this.myMethod, false);
    }
}

myMethod(event:any) {
  console.log(event); // => Ok I've got what I need
  console.log(this.myService); // => Undefined
}

try

document.addEventListener('resume', _ => this.myMethod(), false);

or better:
platform.resume.subscribe(()=>{this.myMethod();})

@user5555 thx a lot. I don’t know what I mixed up, I tried a couple of time platform.resume but didn’t worked out, I kind of had the feeling that maybe I had put the resume inside the ready promise which doesn’t work, not sure. Anyway now it’s ok, I can go forward, thx a lot, kudos!

P.S.: In case someone need the result of the resume:

this.platform.resume.subscribe((event:any) => {
            this.myMethod(event)
        });

The key for providers or other this things to work is to use an arrow function, becaus it doesn’t overwrite the this variable.