I try to start the service, but I see the following message in the logcat message, which makes me wonder if everything really works:
W/ContextImpl( 1506): Calling a method in the system process without a qualified user:
android.app.ContextImpl.startService:1479
android.content.ContextWrapper.startService:494
myapp.startService:765
myapp.onStart:386 a
ndroid.app.Instrumentation.callActivityOnStart:1171
My application is part of the platform assembly and is installed in the system directory . Right now I have this code for Activity (starting a service from onStart):
public class MyAppNotification extends Activity {
@Override
protected void onStart() {
super.onStart();
...
MyAppService.startService(MyAppNotification.this);
}
}
The service then provides this function:
public class MyAppService extends Service {
...
public static void startService(Context context) {
Intent intent = new Intent(context, MyAppService.class);
context.startService(intent);
}
}
I mentioned that the service was previously started by the broadcast receiver, but I would like to switch to starting it manually.
Lastly, is this problem just a poor context handling?
source
share