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 ; |
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); |