I have a service class. I have exported this class to jar and I have embed the jar in my client app.
When needed, I call the service class. When I try to do this, I
I've found the same problem. I lost almost a day trying to start a service from OnClickListener method - outside the onCreate and after 1 day, I still failed!!!! Very frustrating!
I was looking at the sample example RemoteServiceController. Theirs works, but my implementation does not work!
The only way that was working for me, was from inside onCreate method. None of the other variants worked and believe me I've tried them all.
Conclusion:
Also the one "/" couldn't find path to the service, tried starting with Intent(package,className) and nothing , also other type of Intent starting
I moved the service class in the same package of the activity Final form that works
Hopefully this helps someone by defining the listerners onClick inside the onCreate method like this:
public void onCreate() {
//some code......
Button btnStartSrv = (Button)findViewById(R.id.btnStartService);
Button btnStopSrv = (Button)findViewById(R.id.btnStopService);
btnStartSrv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
startService(new Intent("RM_SRV_AIDL"));
}
});
btnStopSrv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
stopService(new Intent("RM_SRV_AIDL"));
}
});
} // end onCreate
Also very important for the Manifest file, be sure that service is child of application:
...