package com.example.administrator.myapplication;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.provider.MediaStore;
import android.widget.Toast;
/**
* Created by Administrator on 2017-02-02.
*/
public class AlramReceiver extends BroadcastReceiver {
private int YOURAPP_NOTIFICATION_ID;
public void onReceive(Context context,Intent intent){
Toast.makeText(context,R.string.app_name, Toast.LENGTH_SHORT).show();
showNotification(context,R.drawable.ic_launcher,
"알람!!", "지금 이러고 있을 시간 없다.");
}
private void showNotification(Context context,int statusBarlconID,
String statusBarTextID, String detailedTextID){
Intent contentIntent=new Intent(context,MainActivity.class);
PendingIntent theappIntent=
PendingIntent.getActivity(context,0,contentIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
CharSequence from="알람";
CharSequence message="무슨짓을 해야 알람이 꺼질까요?";
Notification notif=new Notification(statusBarlconID,null,System.currentTimeMillis());
notif.sound= Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,
"6") ;
notif.flags= Notification.FLAG_INSISTENT;
notif.setLatestEventInfo(context,from,message,theappIntent);
notif.ledARGB= Color.GREEN;
NotificationManager nm=(NotificationManager)context.getSystemService
(Context.NOTIFICATION_SERVICE);
nm.notify(1234,notif);
}
}
notif.setLatestEventInfo(context,from,message,theappIntent);
여기서 setLatestEventInfo 이것이 계속 틀리다고(빨간줄이) 나오는데
왜 틀린건지 모르겠어요. 어떻게 고쳐야 맞는 건가요?