对于某些版本为 2.3.X 的 android 设备,我有一个错误报告:
android.app.RemoteServiceException:startForeground 的错误通知:java.lang.IllegalArgumentException
这是我的方法...
final static int myID = 6785674;
public void putServiceToForeground() {
if (notif == null) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(MyApp.getAppContext())
.setContentTitle("");
notif = mBuilder.build();
notif.icon = R.drawable.pixel;
}
startForeground(myID, notif);
}