마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 알람소스 오류

0 추천
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 이것이 계속 틀리다고(빨간줄이) 나오는데 
왜 틀린건지 모르겠어요. 어떻게 고쳐야 맞는 건가요?
dddffaaas123 (230 포인트) 님이 2017년 2월 2일 질문
dddffaaas123님이 2017년 2월 2일 수정

1개의 답변

0 추천
http://boxfoxs.tistory.com/266

setLatestEventInfo 으로 구글링하면 맨 처음 나오는 건데, 무작정 질문부터 올린 거라면 매우 안 좋은 습관입니다.
쎄미 (162,410 포인트) 님이 2017년 2월 2일 답변
...