Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Copyright 2014 Seven(S.M.J). All rights reserved.
- *
- * @author ddol0225@naver.com
- * @version 1.0.0
- * @comment 레이디스코드 예뻐 예뻐 ♥ / 레코관련코딩 두번째 또 빡코딩잼ㅋㅋ / 서비스 개어렵다!!!
- * @Date 2014.10.31~
- *
- */
- package com.seven.lctimer;
- import android.app.Notification;
- import android.app.NotificationManager;
- import android.app.Service;
- import android.content.Context;
- import android.content.Intent;
- import android.net.Uri;
- import android.os.Handler;
- import android.os.IBinder;
- import android.os.Message;
- import android.os.SystemClock;
- import android.support.v4.app.NotificationCompat;
- import android.util.Log;
- import com.seven.lctimer.MainActivity;
- public class AlarmService extends Service {
- Thread thread;
- //boolean mRunning; // 서비스 작동 여부
- // 알람 관련
- NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); // 알람 서비스 등록
- NotificationCompat.Builder ashley = null; // 빛나시
- NotificationCompat.Builder rise = null; // 리세시
- NotificationCompat.Builder eunb = null; // 은비시
- NotificationCompat.Builder sojung = null; // 소정시
- NotificationCompat.Builder zuny = null; // 주미시
- NotificationCompat.Builder debut = null; // 데뷔시
- long[] vibrate = { 200 }; // 진동
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
- @Override
- public void onCreate() {
- Log.d("service","onCreate 실행");
- }
- @Override
- public void onDestroy() {
- Log.d("service","onDestroy 실행");
- //mRunning = false;
- }
- // 빛나시
- public void AshleyAlarm() {
- Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.ashley);
- ashley = new NotificationCompat.Builder(getApplicationContext())
- .setContentTitle("레이디스 코드 시간 알리미")
- .setContentText("지금은 빛나시 입니다!")
- .setSmallIcon(R.drawable.ic_launcher)
- .setTicker("지금은 빛나시!")
- .setAutoCancel(true)
- .setVibrate(vibrate)
- .setSound(sound);
- manager.notify(1, ashley.build());
- }
- // 리세시
- public void RiseAlarm() {
- Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.rise);
- rise = new NotificationCompat.Builder(getApplicationContext())
- .setContentTitle("레이디스 코드 시간 알리미")
- .setContentText("지금은 리세시 입니다!")
- .setSmallIcon(R.drawable.ic_launcher)
- .setTicker("지금은 리세시!")
- .setAutoCancel(true)
- .setVibrate(vibrate)
- .setSound(sound);
- manager.notify(2, rise.build());
- }
- // 은비시
- public void EunBAlarm() {
- Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.eunb);
- eunb = new NotificationCompat.Builder(getApplicationContext())
- .setContentTitle("레이디스 코드 시간 알리미")
- .setContentText("지금은 은비시 입니다!")
- .setSmallIcon(R.drawable.ic_launcher)
- .setTicker("지금은 은비시!")
- .setAutoCancel(true)
- .setVibrate(vibrate)
- .setSound(sound);
- manager.notify(3, eunb.build());
- }
- // 소정시
- public void SojungAlarm() {
- Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sojung);
- sojung = new NotificationCompat.Builder(getApplicationContext())
- .setContentTitle("레이디스 코드 시간 알리미")
- .setContentText("지금은 소정시 입니다!")
- .setSmallIcon(R.drawable.ic_launcher)
- .setTicker("지금은 소정시!")
- .setAutoCancel(true)
- .setVibrate(vibrate)
- .setSound(sound);
- manager.notify(4, sojung.build());
- }
- // 주미시
- public void ZunyAlarm() {
- Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.zuny);
- sojung = new NotificationCompat.Builder(getApplicationContext())
- .setContentTitle("레이디스 코드 시간 알리미")
- .setContentText("지금은 주미시 입니다!")
- .setSmallIcon(R.drawable.ic_launcher)
- .setTicker("지금은 주미시!")
- .setAutoCancel(true)
- .setVibrate(vibrate)
- .setSound(sound);
- manager.notify(5, zuny.build());
- }
- // 데뷔시
- public void DebutAlarm() {
- Uri sound = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.lc);
- debut = new NotificationCompat.Builder(getApplicationContext())
- .setContentTitle("레이디스 코드 시간 알리미")
- .setContentText("지금은 데뷔시 입니다!")
- .setSmallIcon(R.drawable.ic_launcher)
- .setTicker("지금은 데뷔시!")
- .setAutoCancel(true)
- .setVibrate(vibrate)
- .setSound(sound);
- manager.notify(6, debut.build());
- }
- public int onStartCommand(Intent intent, int flags, int startId) {
- return startId;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement