Are you sure that the code is for B4i?
For me it's B4A code.
PackageManager is part of the B4A Phone library. StartActivity (Intent1) doesn't exist in B4i.
Sorry, but I have no answer to your question.
You are right Klaus and I made the mistake when I was reading that post where I got the code. I thought it was an iOS post but I'm sure you are correct.
Maybe someone can jump in and answer my question: in iOS how to bring an app to the foreground.