Display light on Notification fired - android

I want to display light when notification fires in android
i have try with below code but the screen not displays light
if(isBlink) {
notification.ledOffMS=25;
notification.ledOnMS=100;
notification.ledARGB=Color.RED;
notification.flags=notification.flags|Notification.FLAG_SHOW_LIGHTS;
}

I am not sure about your code and logic inside. But following questions may help you to debug.
How do you trigger isBlink ? Is this through some signal handler ?
How notification parameters gets acknowledged once set ? I suppose you are using some timer or loop logic.

Try to receive this notification with the screen off.. I think google have this requirement to show lights on the led.

Related

How Do I Get Rid of the Progress Indicator for RemoteInput Notifications on Android N?

I used RemoteInput to allow the user to enter some text as part of a Notification on N Developer Preview 1. It worked, but when the user pressed the "send" button, an indefinite progress indicator appeared, and it never goes away:
Is this supposed to happen? How do I get rid of it?
Is this supposed to happen?
Apparently, yes.
How do I get rid of it?
Update the Notification. That could:
Add back in the RemoteInput to accept new input, or
Not add back in the RemoteInput, but perhaps update other aspects of the Notification to indicate that you have received and processed the input
Or, if appropriate, cancel() the Notification.
This sample project demonstrates the use of RemoteInput with the N Developer Preview.

Difference in ways of maintaining Notifications

What is the difference between the function FLAG_ONGOING_EVENT and FLAG_NO_CLEAR how do they make the Notification behave differently? Do they both make the Notification permanent.
Documentation says :
FLAG_ONGOING_EVENT: Bit to be bitwise-ored into the flags field that should be set if this notification is in reference to something
that is ongoing, like a phone call. It should not be set if this
notification is in reference to something that happened at a
particular point in time, like a missed phone call.
FLAG_NO_CLEAR :Bit to be bitwise-ored into the flags field that should
be set if the notification should not be canceled when the user clicks
the Clear all button.
I think in these words they have different meanings so mixing these flags will give you a permanent notification until your program process ends , if you use just FLAG_ONGOING_EVENT this cause your notification runs until your binding service like phone call ends and it's also cancelable by developer or it can be clear by user and when you mix it with the other, user can't clear it from status bar.

Android: Make app transparent and act on the background application

Is it feasible to make our Android application completely transparent (as if its not active at all) and work on the other apps?
My Requirement:
First last an app and after some few settings, make it transparent. Once its transparent, the user will not know that this app is active, however, our app should respond to only specific controls.
This is because of the Broadcast receiver limitation, I will have to use the Volume button for some actions in my application. But, this button doesn't broadcast. So, currently I am using Power button which is not the requirement.
Please throw some light on this. I did some research but, couldnt find any. :(
This is because of the Broadcast receiver limitation, I will have to use the Volume button for some actions in my application. But, this button doesn't broadcast.
I am not sure it this is right. If you read Android BroadCastReceiver for volume key up and down question, it seems that you can detect it in BroadCastRceiver. I've never tried but it might be worth a try. Do something like following:
In your BroadcastReceiver onReceive function, do something like following:
public void onReceive(Context arg0, Intent intent) {
if (intent!=null){
int volume = (Integer)intent.getExtras().get("android.media.EXTRA_VOLUME_STREAM_VALUE");
// Get the old volume from the SharedPOreferences
// volume variable contains the current volume
// Compare it to the old value saved. If it is greater than old value then user pressed the UP Volume button else DOWN volume.
}
}
Also I am not sure that you can make it transparent and still keep it running. You can have a background of an activity as transparent though. How do I create a transparent Activity on Android?. Hope it helps.

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

Status bar Notification in android

I want to set a onClickListner for a status bar Notification. How it is possible ? Please help. Now i can load a Activity by using the pending intent. I like to set a onClickListner for the notificatioin.
Regards
Parvathi
It is not possible to set an OnClickListener for a notification. Because of the way notifications are handled/displayed there is no way to guarantee that the process that created the notification will be running at the time the notification is clicked. This means that any code you wrote to provide click handling may not be running.
If you need click listener style behavior you will have to do it using the PendingIntent: set it to start a Service that runs the logic or to use an Intent that is received by a BroadcastReceiver. This will let you perform activity without requiring a UI.

Categories

Resources