I have an Android device where the default is for the Notification bar to be off so you cannot drag it down. I want to write a simple program that turns the notification bar back on so you can drag it down to view the notifications. If someone could show me the code to do that I would be very grateful.
+1
A:
First ,you must Have a look at Android SDK - Creating Status Bar Notifications page.
NotificationManager manger = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon,
"Notification text that will be shown on status bar.", System
.currentTimeMillis());
// The PendingIntent will launch activity if the user selects this
// notification
PendingIntent contentIntent = PendingIntent.getActivity(context,
REQUEST_CODE, new Intent(this, MyActivity.class), 0);
notification.setLatestEventInfo(this, "Content Title", "Content text",
contentIntent);
manger.notify(NOTIFICATION_ID, notification);
For having an example, refer this anddev.org page .
Also having a look at this Example .
PM - Paresh Mayani
2010-07-31 10:45:26
A:
On what device is "the default is for the Notification bar to be off"? If an app can't rely on being able to post a notification such that the user can see and respond to it without the app doing anything additional, that is not a compatible device and the manufacturer needs to fix it.
hackbod
2010-07-31 16:42:12