Click here to Skip to main content
12,073,325 members (67,154 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET Mobile Android
Calendar calendar = Calendar.getInstance();
/*calendar.get(Calendar.DAY_OF_YEAR)
SimpleDateFormat dateFormat = new SimpleDateFormat("KK:mm:ss a");
String oldTime = "12:00:01 PM";
String oldTime1 = "12:20:20 PM";*/

String _day=_objapi.getday(ctx);
String _today=String.valueOf(calendar.get(Calendar.DAY_OF_YEAR));
String _isread=_objapi.getIsRead(ctx);
if("0".equals(_day))
{
_objapi.saveday(_today, ctx);
_objapi.saveIsRead("0", ctx);
}

if("0".equals(_isread))
{
if(!_today.equals(_day))
{

mNotificationManager = (NotificationManager)ctx.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notifyDetails = new Notification(R.drawable.logo,"SMS Block",System.currentTimeMillis());
Intent notificationIntent = new Intent(ctx,MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
notifyDetails.setLatestEventInfo(ctx, "SMS Block", "Click on me to view SMS Log", contentIntent);
notifyDetails.flags |= Notification.FLAG_AUTO_CANCEL;
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
_objapi.saveIsRead("1", ctx);

}

}


----------------

package com.hukamnama.net;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class API {
private static final String APP_SHARED_PREFS = "com.hukamnama.net"; // Name of the file -.xml
private SharedPreferences appSharedPrefs;
private Editor prefsEditor;

//################--get session user ID--###########################
public String getday(Context Activityctx) {
this.appSharedPrefs = Activityctx.getSharedPreferences(APP_SHARED_PREFS, Activity.MODE_PRIVATE);
this.prefsEditor = appSharedPrefs.edit();
return appSharedPrefs.getString("_day", "0");
}
public String getIsRead(Context Activityctx) {
this.appSharedPrefs = Activityctx.getSharedPreferences(APP_SHARED_PREFS, Activity.MODE_PRIVATE);
this.prefsEditor = appSharedPrefs.edit();
return appSharedPrefs.getString("_IsRead", "0");
}


//################--save session ID--###########################
public void saveday(String _day,Context Activityctx) {
this.appSharedPrefs = Activityctx.getSharedPreferences(APP_SHARED_PREFS, Activity.MODE_PRIVATE);
this.prefsEditor = appSharedPrefs.edit();
prefsEditor.putString("_day", _day);
prefsEditor.commit();
}
public void saveIsRead(String _IsRead,Context Activityctx) {
this.appSharedPrefs = Activityctx.getSharedPreferences(APP_SHARED_PREFS, Activity.MODE_PRIVATE);
this.prefsEditor = appSharedPrefs.edit();
prefsEditor.putString("_IsRead", _IsRead);
prefsEditor.commit();
}

}
Posted 29-Aug-12 2:05am
Comments
ridoy 29-Aug-12 7:39am
   
where is your question?what is your problem?!
Richard MacCutchan 29-Aug-12 8:06am
   
This should be reported as 'not a question'.
Wes Aday 29-Aug-12 9:32am
   
Just an unformatted code dump.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100