@Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub db = new DBHelper(context); mContext = context; Calendar c = Calendar.getInstance(); int yy = c.get(Calendar.YEAR); int mm = c.get(Calendar.MONTH) + 1; int dd = c.get(Calendar.DATE); int hh = c.get(Calendar.HOUR_OF_DAY); int mn = c.get(Calendar.MINUTE); int nw = (hh * 60) + mn; Cursor cur = db.getAllTaskByDate(yy, mm, dd); if (cur.moveToFirst()) { do { int tstime = cur.getInt(cur.getColumnIndex("stime")); int tstimem = cur.getInt(cur.getColumnIndex("stimem")); int tt = (tstime * 60) + tstimem; if ((tt - nw) <= 5 && (tt - nw) > 0) { String title = cur.getString(cur.getColumnIndex("tname")); showNotification(context, 1, title, "Starts at " + tstime + ":" + tstimem); } } while (cur.moveToNext()); } cur.close(); if (mm == 0) { Cursor lcur = db.getLogin(); int id = 0; if (lcur.moveToFirst()) { id = lcur.getInt(lcur.getColumnIndex("uid")); } lcur.close(); Cursor mcur = db.getTaskByPendingSync(); if (mcur.moveToFirst()) { do { int tid = mcur.getInt(mcur.getColumnIndex("tid")); int rating = mcur.getInt(mcur.getColumnIndex("rating")); String feedback = mcur.getString(mcur.getColumnIndex("feedback")); if (isNetworkAvailable() && id != 0) { new RequestTask() .execute( context.getResources().getString(R.string.server) + "services/feedbackcollector.php?" + "id=" + id + "&tid=" + tid + "&rating=" + rating + "&feedback=" + feedback); } } while (mcur.moveToNext()); } mcur.close(); } }