이 그가 시작됩니다에 시스템 트레이 클릭에 통지를 표시하여 사용자 로그인으로 서비스를 시작하고 지정된 시간 후 도달 할 때까지에 카운터을 유지 당신이 달성 할 수있는 방법은 두 가지가 있습니다 보류중인 의도 나머지 로그 아웃 논리도 구현할 수 있습니다. 여기
// Instantiate a Builder object.
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
// Creates an Intent for the Activity
Intent notifyIntent =
new Intent(new ComponentName(this, ResultActivity.class));
// Sets the Activity to start in a new, empty task
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TASK);
// Creates the PendingIntent
PendingIntent pendingIntent =
PendingIntent.getActivity(
this,
0,
notifyIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
// Puts the PendingIntent into the notification builder
builder.setContentIntent(pendingIntent);
// Notifications are issued by sending them to the
// NotificationManager system service.
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// Builds an anonymous Notification object from the builder, and
// passes it to the NotificationManager
mNotificationManager.notify(id, builder.build());
이 알림
또는 특수 허가를 요청에 부동 창을 만들 수 있습니다에 대한 here 자세한 내용을 통지를 만드는 간단한 예입니다. 시스템에서 가져와야하는 경우 부동 창 (오버레이이라고도 함)을 만들 수 없습니다.
Here에 대한 전체 자습서이지만이 방법은 권장되지 않으므로 알려 주시면 좋습니다.