private void stopAlert(Alarm alarm) { mVibrator.cancel(); mCondition.open(); mNotificationManager.cancel(alarm.hashCode()); Log.d(TAG, "Stoped the alert.: " + alarm.dump()); stopSelf(); }
@SuppressWarnings("deprecation") private void showNotification(Alarm alarm) { String title = getString(R.string.app_name) + ": " + alarm.getLavel(); String message = "アラームは" + alarm.getDuration() + "分間鳴って停止しました。"; // TODO リソースへ String ticker = title; Notification notification = new Notification(R.drawable.ic_launcher, ticker, System.currentTimeMillis()); Intent doNothing = new Intent(); notification.setLatestEventInfo( this, title, message, PendingIntent.getActivity(this, 0, doNothing, 0)); mNotificationManager.notify(alarm.hashCode(), notification); }