Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET 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 at 29-Aug-12 7:39am
   
where is your question?what is your problem?!
Richard MacCutchan at 29-Aug-12 8:06am
   
This should be reported as 'not a question'.
Wes Aday at 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
0 OriginalGriff 215
1 George Jonsson 175
2 Kornfeld Eliyahu Peter 159
3 PIEBALDconsult 110
4 Richard MacCutchan 85
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2014
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