Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is Context.startServiceAsUser()?

Tags:

android

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?

like image 670
sing lam Avatar asked Jun 24 '26 17:06

sing lam


1 Answers

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.

like image 82
JoxTraex Avatar answered Jun 27 '26 17:06

JoxTraex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!