Skip to content Skip to sidebar Skip to footer

Setlatesteventinfo Cannot Be Resolved

I am trying to do a notification on api level 10 and below is my code but im getting a syntax error setLatestEventInfo cannot be resolved. I am guessing its something to do with th

Solution 1:

If your compile SDK version is set to api 23+ you'll see this issue. This method was removed in M (api 23).

To do notifications for api 4 onwards you can use the NotificationCompat.Builder which was added in the Android Support Library. The Android Documentation has a decent example:

Notificationnoti=newNotification.Builder(mContext)
         .setContentTitle("New mail from " + sender.toString())
         .setContentText(subject)
         .setSmallIcon(R.drawable.new_mail)
         .setLargeIcon(aBitmap)
         .build();

You can replace "Notification.Builder" for "NotificationCompat" if need to support older api versions.

Post a Comment for "Setlatesteventinfo Cannot Be Resolved"