List of usage examples for android.app NotificationManager toString
public String toString()
From source file:com.android.example.leanback.fastlane.RecommendationsService.java
@Override protected void onHandleIntent(Intent intent) { ContentProviderClient client = getContentResolver() .acquireContentProviderClient(VideoItemContract.VideoItem.buildDirUri()); try {//from w w w .ja v a 2 s. c o m Cursor cursor = client.query(VideoItemContract.VideoItem.buildDirUri(), VideoDataManager.PROJECTION, null, null, VideoItemContract.VideoItem.DEFAULT_SORT); VideoDataManager.VideoItemMapper mapper = new VideoDataManager.VideoItemMapper(); mapper.bindColumns(cursor); NotificationManager mNotificationManager = (NotificationManager) getApplicationContext() .getSystemService(Context.NOTIFICATION_SERVICE); Log.d(TAG, mNotificationManager == null ? "It's null" : mNotificationManager.toString()); int count = 1; while (cursor.moveToNext() && count <= MAX_RECOMMENDATIONS) { Video video = mapper.bind(cursor); PendingIntent pendingIntent = buildPendingIntent(video); Bundle extras = new Bundle(); extras.putString(EXTRA_BACKGROUND_IMAGE_URL, video.getThumbUrl()); Bitmap image = Picasso.with(getApplicationContext()).load(video.getThumbUrl()) .resize(VideoDetailsFragment.dpToPx(DETAIL_THUMB_WIDTH, getApplicationContext()), VideoDetailsFragment.dpToPx(DETAIL_THUMB_HEIGHT, getApplicationContext())) .get(); Notification notification = new NotificationCompat.BigPictureStyle( new NotificationCompat.Builder(getApplicationContext()).setContentTitle(video.getTitle()) .setContentText(video.getDescription()).setPriority(4).setLocalOnly(true) .setOngoing(true) .setColor(getApplicationContext().getResources().getColor(R.color.primary)) // .setCategory(Notification.CATEGORY_RECOMMENDATION) .setCategory("recommendation").setLargeIcon(image) .setSmallIcon(R.drawable.ic_stat_f).setContentIntent(pendingIntent) .setExtras(extras)).build(); mNotificationManager.notify(count, notification); count++; } cursor.close(); } catch (RemoteException re) { Log.e(TAG, "Cannot query VideoItems", re); } catch (IOException re) { Log.e(TAG, "Cannot download thumbnail", re); } finally { client.release(); } }