java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.ba.cal

java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.exampler.backservice }

Before running very well, today into AAR embedded in the main project, suddenly reported an error as above

After asking, it turns out that the call to service intent has changed after Android 5.0. I have to use the display call, but I use the implicit one in my project, so I report an error. The modification is as follows

Intent intent = new Intent();
intent.setAction(Base.ACTION_BACK_SERVICE);
intent.setPackage(getPackageName());  //Add this line here to indicate compatibility after 5.0
this.startService(intent);

Working well, perfect

Similar Posts: