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

Was it helpful?

Solution

You can use NotificationCompat.Build from the Support Library to create Notifications that work on all platform levels.

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:

http://code.google.com/p/android-change-log/source/browse/trunk/src/sheetrock/panda/changelog/ChangeLog.java?spec=svn52&r=52

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
scroll top