当前位置: 代码迷 >> Android >> getSystemService(Context.NOTIFICATION_SERVICE); 有关问题
  详细解决方案

getSystemService(Context.NOTIFICATION_SERVICE); 有关问题

热度:84   发布时间:2016-04-28 03:43:02.0
getSystemService(Context.NOTIFICATION_SERVICE); 问题
    NotificationCompat.Builder mBuilder;
    NotificationManager mNm;
  void showNoti(String filename) {
  if (mBuilder == null) {
  mBuilder = new NotificationCompat.Builder(this);
  mBuilder.setContentTitle(filename)
  .setContentText(getString(R.string.file_sending))
  .setSmallIcon(R.drawable.ic_launcher);
  mNm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  }
  mNm.notify(997, mBuilder.build());
  }

执行以上代码,在手机状态栏上未有显示,请问
getSystemService(Context.NOTIFICATION_SERVICE); Context.NOTIFICATION_SERVICE内容应是什么?
------解决思路----------------------
public static final String NOTIFICATION_SERVICE = "notification";

这个就是个字符串而已。 
------解决思路----------------------
这个要仔细查查源码.
  相关解决方案