/[projects]/android/CheckUpdates/src/dk/thoerup/checkupdates/CheckUpdates.java
ViewVC logotype

Diff of /android/CheckUpdates/src/dk/thoerup/checkupdates/CheckUpdates.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 943 by torben, Wed Jun 30 21:55:56 2010 UTC revision 944 by torben, Thu Jul 1 05:43:10 2010 UTC
# Line 24  import android.os.AsyncTask; Line 24  import android.os.AsyncTask;
24  import android.util.Log;  import android.util.Log;
25    
26  public class CheckUpdates {  public class CheckUpdates {
27          final static long TIMESPAN_DAY = 24*60*60*1000; // one day          final static long TIMESPAN_DAY = /*24*60*60* */1000; // one day
28                    
29          final static String CHECKUPDATES = "CheckUpdates";          final static String CHECKUPDATES = "CheckUpdates";
30          final static String LASTCHECK = "lastcheck";          final static String LASTCHECK = "lastcheck";
# Line 154  public class CheckUpdates { Line 154  public class CheckUpdates {
154                                    
155                  private void showNotification(String launchUrl) {                  private void showNotification(String launchUrl) {
156                          NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);                          NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
157                          int icon = android.R.drawable.sym_action_email; //TODO: find a better icon                          //int icon = android.R.drawable.sym_action_email; //TODO: find a better icon
158                            int icon = R.drawable.searchicon;
159                                                    
160                          Notification notification = new Notification(icon, "Update available", System.currentTimeMillis() );                          Notification notification = new Notification(icon, "Update available", System.currentTimeMillis() );
161                          notification.flags |= Notification.FLAG_AUTO_CANCEL ;                          notification.flags |= Notification.FLAG_AUTO_CANCEL ;
# Line 162  public class CheckUpdates { Line 163  public class CheckUpdates {
163                          CharSequence contentTitle = title;                          CharSequence contentTitle = title;
164                          CharSequence contentText = "New version available.";                          CharSequence contentText = "New version available.";
165                          Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(launchUrl) );                          Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(launchUrl) );
166                            notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
167                          PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);                          PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
168    
169                          notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);                          notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

Legend:
Removed from v.943  
changed lines
  Added in v.944

  ViewVC Help
Powered by ViewVC 1.1.20