How to set the Notification Area in Android? - android

When a notification arrives it hides the network signal and battery status icons.
Is there any possibility to show the notification without hiding the network icons?

When a notification arrives it hides the network signal and battery status icons.
For about 1-2 seconds, while the ticker text is being displayed.
Is there any possibility to show the notification without hiding the network icons?
AFAIK, no. You could try an empty/null ticker text and see what happens -- I haven't tried that.

Related

Lock Screen and Status Bar hangs with foreground service notification

I have used foreground service with a custom notification layout. Everytime the notification is present the lock screen and the status bar gets very slow. Everywhere the notification is shown that part of the mobile UI becomes slow. Whenever I open such places phone goes 10Hz display. This happens only in few devices.

How to increase duration of heads up for Android notification

I am developing a react-native app with a video call feature and need it to display a 'heads up' notification that lasts for 40 seconds when the user receives a call, but the notification only displays for about three seconds before disappearing. I have tried setting the category to 'call' and priority to 'max' on Android 6.0 but to no avail.
An image displaying a notification for an incoming call:
You should use the equivalent to the setFullScreenIntent() API on your notification:
An intent to launch instead of posting the notification to the status bar. Only for use with extremely high-priority notifications demanding the user's immediate attention, such as an incoming phone call or alarm clock that the user has explicitly set to a particular time.
The system UI may choose to display a heads-up notification, instead of launching this intent, while the user is using the device.
When you set a full screen Intent on your Notification, two things happen:
When the screen is off, the activity you've set via the full screen intent is launched instead of the notification being posted.
When the screen is on, your notification will be posted as a heads up notification that will be persistent (it won't collapse to the status bar unlike a normal heads up notification).

Xamarin.Android - Keep the app working in background after closing it with a local notification

Currently, I have a mobile application written in Xamarin.Android. Because there are constant HTTP requests going on in the app, what I'd like to do is keep the application active after closing it.
What I am looking at, is for example after you close the app, in the background it keeps sending HTTP requests, but there is a local notification where when you click it you can open the app. There should be an explicit button for the exit which could be inside the application. In more details, HTTP requests are sent on some interval in seconds.
So my end goal is to have the app constantly running, if it's in a background, then show a notification that it's still up and be able to close it (even from the background) only from the inside of the app.
I couldn't find many resources specifically about this question and I am not quite sure what I can use in order to make this work.
Thanks in advance!
According to the documentation what you're trying to do is supported:
Sending notifications to the user
When a service is running, it can notify the user of events using
Toast Notifications or Status Bar Notifications.
A toast notification is a message that appears on the surface of the
current window for only a moment before disappearing. A status bar
notification provides an icon in the status bar with a message, which
the user can select in order to take an action (such as start an
activity).
Usually, a status bar notification is the best technique to use when
background work such as a file download has completed, and the user
can now act on it. When the user selects the notification from the
expanded view, the notification can start an activity (such as to
display the downloaded file).
See the Toast Notifications or Status Bar Notifications developer
guides for more information.
ref: https://developer.android.com/guide/components/services
ref: https://developer.android.com/guide/components/processes-and-threads

In Android is it possible to continuously show status bar notification

In my app, I have to continuously show status bar notification after some event is triggered. The status bar must glow in red rather than in default background. During that period,I am responsible for recording sound i.e. it is just like recorder but the instead of running in Activity, it will run on Service and the user is notified by blinking status bar in red. The user at any time can go the status bar and stop the recording.And the recording can carry on even when lockscreen is on.
So is it possible to achieve this in Android and if possible could you give us some logic for this implementation.
Consider using a foreground service, which lets you post an ongoing notification. There's no API for changing the color of the entire status bar. You can certainly color your icons, and on JellyBean and later you may be able to change the color of the notification itself using RemoteViews -- that's talked about in this link.

Hiding status bar notification icon for foreground service after raising PRIORITY_MAX notification

First, do this (tested on Nexus 5 running 4.4.2):
Pass a PRIORITY_LOW notification to Service.startForeground().
Observe notification is not shown in status bar.
Raise a PRIORITY_MAX notification using same notification ID.
Observe notification is shown in status bar.
Now, is there any way to remove that icon from the status bar (other than Service.stopForeground())?
I've tried calling NotificationManager.cancel() and NotificationManager.cancelAll(). And also tried raising the same original PRIORITY_LOW notification. But all of them leave the notification icon in the status bar.
This was changed in Android 4.3, to always show notifications for foreground services.
There is a good reason for this, namely that foreground services cannot be killed when the system needs more resources. If the notification is not there, there is no way for a normal user to know that there is something still running and draining battery.
If you don't want the notification, consider using a background service instead. If you really need a foreground service, the user have the right to know.
Read more on http://commonsware.com/blog/2013/07/30/notifications-foreground-services-android-4p3.html
One workaround is to call Service.stopForeground() followed by Service.startForeground().

Categories

Resources