Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int noti(String title, String body, String ico){
- //Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();
- showToast(title+">"+body+">"+ico);
- try{
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com/"));
- PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);
- Notification.Builder mBuilder =
- new Notification.Builder(getApplicationContext(), "83")
- .setSmallIcon(Icon.createWithContentUri(ico))
- .setContentTitle(title)
- .setContentText(body)
- .setOngoing(true)
- .setContentIntent(pendingIntent)
- .setPriority(NotificationCompat.PRIORITY_DEFAULT);
- NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplicationContext());
- Notification noti = mBuilder.build();
- if(noti==null){
- logBack("noti.builder == null.");
- return -2;
- }
- int notificationId = notiIDz.getAndIncrement();
- // notificationId is a unique int for each notification that you must define
- notificationManager.notify(notificationId, noti);
- return notificationId;
- } catch(Exception e){
- logBack(e.toString());
- }
- return -1;
Add Comment
Please, Sign In to add comment