service.java
@SuppressWarnings("deprecation")
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i(TAG, " +++ onStartCommand Service +++");
startForeground(startId,new Notification());
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
notification = new Notification.Builder(getApplicationContext())
.setContentTitle("")
.setContentText("")
.build();
}else{
notification = new Notification(0, "", System.currentTimeMillis());
notification.setLatestEventInfo(getApplicationContext(), "", "", null);
}
nm.notify(startId, notification);
nm.cancel(startId);
return super.onStartCommand(intent, flags, startId);
}
cancel이 될때 있고 안될때 있고, 휴대폰마다 적용될때 있고 안될때가 있던데
어떻게 수정해야하나요?