Notifications with buttons, possible on Froyo+? - android

I'm looking to do something along the lines of the image below, with the "Snooze" button, but I'm trying to do it on Froyo and later. Is it possible to do this on pre 4.0 devices? I basically want to give the user the option to close my ongoing service from the notification bar.

You can use NotificationCompat:
http://developer.android.com/reference/android/support/v4/app/NotificationCompat.html
Add support libraries revision 10 more info http://developer.android.com/tools/extras/support-library.html

Related

How set badge number in home screen app icon android programatically?

I would like create app with custom badge number in app icon, like in facebook app: App icon in home screen shows pending/unread notifications. How to set custom badge number programatically in android. I've seen similar questions in stack with answers like it "doesn't support in stock android". Seen many answers and were old. I think they were for old versions. Is it possible in newer versions of android? If possible how to add customized badge number ? If the option is still doesn't support by android ignore this question and please let me know it. I'm developing kind of confidential app, so that i couldn't use third part libs. Is there any inbuilt methods to handle badges or possible to create badge?
There is popular github that works app icon badges for most Android devices. Sure still some platform, some devices didn't support that. But those libraries almost cover all of the devices that support app icon badges.
https://github.com/leolin310148/ShortcutBadger
So to your question, No.
Because Android framework didn't define the app notification badges before.(I am not sure if Android default framework have it now. I've been search the keyword of BADGE_COUNT_UPDATE in the ASOP android7 and nothing found) So all those custom badges are made by device manufacturer framework developer.
You can check how they setup badges numbers for each manufacturer here
https://github.com/leolin310148/ShortcutBadger/tree/master/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl
To another question. I use keyword badge to search the ASOP source code and didn't find any noticeable part about app icon badges. And even there is one inbuilt framework method about this after certain version of android. The framework still cannot cover all the devices before the certain version. So not quite sure what do you mean by confidential app, but using libraries is the first choice to cover most android devices based on the real situation like this.

Android programming. choosing number

it is hard to search for what i want because i have no idea what it is called so i do not know how exactly to ask this.
i want to make the user to choose numbers just like this in my application.
for example i put 3 of those and i set a certain number of values for each (for example from 0 to 22 in the first, from 5 to 40 in the second and 0 to 60 in third). and later the user chooses his values and when submitting the app reacts considering his choices.
thanks
That widget that you're looking for is called a 'Number Picker' and you can find more info about it here.
Android has a native implementation for a widget like this, it's called NumberPicker.
However, it was added alongside API 11 (3.0 or Honeycomb). So it might give you trouble if you want to support older Android versions. As an aternative, this library will help you if you're planning to support older APIs, it has been tested and confirmed working down to API 7 (2.1 or Eclair).
As a bonus, you could also give BetterPicker library a shot - it supports many kind of beautiful and customizable pickers.

Titanium PushNotification How to display in one group?

I am facing a problem with development a application.
I am using a Cloud Push Notification with Titanium Appcelerator.
I have need display push Notification in Group.
How display this is display in single particular particular tab?
I am sharing 2 images
Currently looking like this.
I have need look like this. How do?
You have to use a Big View Notification Style but it is only available in 4.1 or newer
quote from here:
A notification's big view appears only when the notification is expanded, which happens when the notification is at the top of the notification drawer, or when the user expands the notification with a gesture. Expanded notifications are available starting with Android 4.1.
in the same document, you can find a sample how to use this. there are also som tips/hints how to maintain compatibility with older devices (not only regarded to the big view)
you must put the following code in your TiApp.xml
<property name="acs-grouped-notification-message-" type="string">You have $number$ unread messages.</property>

Getting the information of applications that are on notification bar

I'm doing an app that opens whatever applications that show up on status bar so that I can easily view one and go to next one, without having to press every notifications to go to each app. Is there any way I can get the list of apps that are on status bar, or is it not possible at all? Sorry if this has already been covered here and thanks in advance.
Latest OS version 4.3 introduced this capability in the API. Check out NotificationListenerService.
Feature update notes.

Dynamic notification icons (large) in Android, targeting 2.2

This question has been asked before, but has not been properly answered yet. I know this is possible but we're feeling a little confused.
We need to display custom/dynamic images in the status bar when push notifications are received. We're concerned with the larger image seen in the pull-down, not the small image in the actual status bar. Because they need to be dynamic, the images can not be packaged with the apk and we are trying to target Android 2.2
What we're trying to achieve is similar to how Facebook displays the profile image of the user who initiated the notification in the notification bar. It's also similar to how whatsApp shows the group image in the notification bar when a new push notification arrives.
From what we've read, this is possible only in Android 3+, sdk 11. But that can't be true.
We've installed both Facebook and WhatsApp on an Android phone running 2.3.4 and sure enough, custom icons display in the notification bar.
So what's the secret? How do they do it? How can we do it?
so what you are trying to do is set the setLargeIcon(Bitmap icon) in the notification builder. This is available in APi 11 and above (honeycomb). The notification builder in the compatibility package v9 can set it for you, but it will only appear on api 11 and above.
To achieve the same effect in 2.3 and below you must create a custom notification layout and set it with setContent(RemoteViews views) in Notification.Builder to generate a custom layout. This can be styled with a large icon on the left side to imitate the > API 11 styles.
Creating custom layouts is tricky and many things have to be taken into account, such as available screen size on other devices to display the notification, and themed text colors (especially as notifications used to be dark text on white bg, now they are light text on dark bg) There plenty of guides and even SO posts that can help you out (such as this one)
In regards to getting a dynamic image, when the phone receives the message (push notification or whatever) and your app goes to build the notification, you can do a small http request to pull a dynamic image before building the notification. This will delay the posting a few seconds, but it doesn't really matter. Then you can get the resulting image and use it in the notification. The specific image can be chosen by sending some data with the (im assuming push notification) that identifies what photo, such as a url, or an id that you can append onto an already existing url in your notification building part of the app.
Hope this helps, any followups just ask :)
You can't use anything but prepackaged drawables as your notification icon as seen on status bar. And no, you did not see anything like you look for in FB app (or you talk about notification area seen when you pull it down).

Categories

Resources