안녕하세요?
INotificationManager.aidl 에 함수를 하나 추가하고 싶어서 편집을 하는데 잘 안됩니다.
void enqueueNotificationWithTag(String pkg, String tag, int id, in Notification notification, inout int[] idReceived); 와 유사하면서 context를 넘겨주기 위해 아래와 같이 추가를 하였습니다.
void enqueueNotificationWithTagContext(Context mContext, String pkg, String tag, int id, in Notification notification, inout int[] idReceived);
그리고 상단에import android.content.Context; 도 추가를 했습니다.
헌데 compile 하면, frameworks/base/core/java/android/app/INotificationManager.aidl:20: couldn't find import for class android.content.Context 에러가 발생합니다.
해당 Error를 수정하고 싶은데, 방법이 있으시면 감사하겠습니다.
Notification 단에서 Toast 를 실행하려고 하니, Context가 필요해서 여러가지 방법을 찾다가
public void notify(String tag, int id, Notification notification)
{
int[] idOut = new int[1];
INotificationManager service = getService();
String pkg = mContext.getPackageName();
if (localLOGV) Log.v(TAG, pkg + ": notify(" + id + ", " + notification + ")");
try {
// service.enqueueNotificationWithTag(pkg, tag, id, notification, idOut);
service.enqueueNotificationWithTagContext(mContext, pkg, tag, id, notification, idOut); /// <== 여기
if (id != idOut[0]) {
Log.w(TAG, "notify: id corrupted: sent " + id + ", got back " + idOut[0]);
}
} catch (RemoteException e) {
}
}
위와 같이 Context를 넘겨주고 이것을 이용해서 Toast box를 띠워 보려고 하는데 잘 안되네요. 뭐 좋은 방법이 있을까요 ?