android: alarm statusicon like the original alarm app? - android

I am making a alarm app and was just wondering how do I show a alarm icon at the right side of the statusbar like the original alarm app? normal notifications appear in the left side and I cant find anything about this....

Have searched for days and found it now in the alarm source code =)
Intent alarmChanged = new Intent("android.intent.action.ALARM_CHANGED");
alarmChanged.putExtra("alarmSet", true/*false if you want to hide it*/);
context.sendBroadcast(alarmChanged);

SDK applications can only use Notifications, which go on the left side of the status bar. Firmware applications can place icons elsewhere.

Related

Custom Notification Manager

I can't remove my app notification from notification bar by sliding/swiping or with default "clear all" option in android.
I got .setAutoCancel(true) in code as well.
But it seems that doesn't work.
anyway to make it removable by swiping like I can do on other app notification. Mine just stuck there.
I know the cancel() and cancelAll(), and giving an intent method to remove by touch (from other stackflow posts).
I just found an help in another stackflow post..(was opposite of my requirement).
For me, I needed to make false in ongoing
nBuilder.setOngoing(false);
where, nBuilder is my Notification.builder

Android show icon in Status bar

I want to show my App Icon in status bar without notification tray/drawer. just like alarm icon shows. I am also making application similar to alarm clock.
I have dig out few questions on stackoverflow, some say it is not possible without notification tray/drawer, but I have seen few apps doing this.
Can any one guide me better?
Thanks
You gave some alarm clock applications as examples, so I think you can start from understanding what this alarm clock icon in status bar is, and how it is shown there.
I note, that, as you can see, application "Alarm Clock Plus" doesn't set its own icon to status bar, just system icon for alarm.
You can see here how you can manipulate this icon on Pre-Lollipop only:
protected void setStatusBarIcon(boolean enabled)
{
Intent alarmChanged = new Intent("android.intent.action.ALARM_CHANGED");
alarmChanged.putExtra("alarmSet", enabled);
sendBroadcast(alarmChanged);
}
If you can give an example of application that puts its own (different from system alarm icon) icon to status bar (not as notification), it could help to see that it is possible.
Unfortunately, I don't think that it is possible.
Even just logically: there are two parts of status bar – user (notifications) and system (other). If system allows to put something to system part – there will be so much useless icons (posted by other applications), and there will be no consistency, and it might break all of the use experience. I think.
Hope it helps

is there any listener after performing clear notification in android?

Basicly I want to do something after the user clear my notification from the top bar, How do I do that in andorid programmatically?
Basic example or complete code would be nice thanks.
When you create a Notification,setDeleteIntent ,Here is the api:
setDeleteIntent(PendingIntent intent)
Supply a PendingIntent to send when the notification is cleared explicitly by the user.

Android - jelly bean notification dismiss button

The google play music app has a little 'X' in the top right corner, instead of displaying the time and a miniature notification icon in that location. Tapping the button kills the player and closes the notification. Great!
I'd like to do the same with my app - Is this only possible by inflating remote views and associating a custom button with an intent to destroy the service, or is there some notification builder methods that I'm overlooking which do that job?
There are no notification builder methods which achieve this. The only solution is to create a custom button with a pending intent to perform the action required.

Trigger a notification every x days

I want to trigger a notification in the status bar every x days(that the user will define in the application). How can i code this ?
Thank you.
AlarmManager was designed for stuff like that.
Assuming you already know how to code an android app, you can see these pages for code examples:
To trigger a notification in the status bar: http://developer.android.com/guide/topics/ui/notifiers/notifications.html
To run the trigger evey x days, you can use AlarmManager: http://developer.android.com/reference/android/app/AlarmManager.html

Categories

Resources