You can use NotificationCompat.Build from the Support Library to create Notifications that work on all platform levels.
Is it possible to support Android Pre-JellyBean and Post-JellyBean Notifications?
-
01-06-2022 - |
Question
Is it possible to do something like this?:
not = AndroidCheck.isJellyBeanOrLater() ? notB.build()
: notB.getNotification();
this turn out error on .build()
because it is a JellyBean(API16) and later method and .getNotification() is a early to JellyBean method.
API MinVersion=10 Version=17
the objective is: the android version is early to JellyBean it uses .getNotification()
deprecated method, if not it uses the actual .build()
method.
Can you please try to help me? =)
thks
Solution
OTHER TIPS
You must put the call to .build() in a seperate class. Once Android loads the class with the call to the new API on an older Android Version Phone -> you get a RuntimeError.
Check this out:
See lines 39-41, 144-145 (here is the call to the newer API), 324-341
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow