broadcastreceiver - Android Blinking screen -


My customer needs this, where he wants to call that the old phone used to get a notification Take a nap (Remember the old Nokia 1100). Well, I have never seen an Android phone like this so I'm not even sure that can be done.

I thought that such a thing could be done in such a way and it could illuminate the screen light again and again. Here's my code:

  Window Manager. Layout Parameters = getWindow () GetAttributes (); Params.screenBrightness = -1; . GetWindow () setAttributes (parameter);   

The problem is, because I am on a broadcast receiver, I do not have the "getWindow ()" method

Anyway, do you think that one of these The easy way? Maybe I'm not coming right.

For your broadcaster receiver , you are missing an important point A Broadcast receiver does not mean too much processing - in fact it is low, it is better, besides, you never know that the receiver app is in the background - there is no sense in the Android Framework for asking a receiver for its window is.

IMHO is a broadcast receiver intended to receive only one intent, and pass it directly to activity or service (and in rare cases Application for the object itself).

So in your case, you should use the BroadcastReceiver to launch a activity , which is probably a transparent activity where you have a You can set the animation that cycle the alpha values ​​of a black background and a transparent background. This can be your blinking.

The issue is: Do not process Broadcast receivers . If you follow this approach, you will find that the Activity.getWindow () method requires you.


About polishing the screen - If you want to be able to sleep when it sleeps, then to wake the phone, and thus turn the screen on, so you can wake up. Unfortunately, a complete tutorial about how they work is actually out of the question, but this should move you in the right direction.

You can also enjoy googling for commons, WakefulIntentService , although you probably do not need it in this case.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -