Dear all android Expert,
Currently, I grab an open source Android project (wso2 agent) that need to use the API startServiceAsUser() in Context class. However, android studio cannot recognize this API. How can I resolve this error?
You cannot call that API because its not a public API from the perspective of the android SDK. This is a part of the framework internal APIs. Generally apps should NOT use these APIs, that is why they are hidden.
If you are trying to call it, you need to use reflection. But before you do, really evaluate if you absolutely have to use startServiceAsUser() as most apps are user centric and not singular, which is what this is needed for.