Flashing Screen in Android - android

I made a android project, now my project has a need to set up a alarm type, like blinking screen for which user can see that screen is blinking,
Flashing screen means, screen back light is turn off/on regularly.
Like we make a thread and after every 500 milliseconds we toggle the screen light.
How i do this...

To modify screen brightness, take a look at this question
For repeating schedulded events you can make use of the standard java Timer/TimerTask or simply play with android Handler.postDelayed(Runnable,delay)
For a short introduction to the later, see this question.
Happy coding!

Related

How can I disable the Android system notification that appears after I take a screen capture?

Whenever I take a screen capture on my Pixel (I take several each day), the system gives me a "helpful" notification that the screenshot was captured. This is a terrible user experience for me since it stops my music, dings, and then shows an alert that I have to dismiss. I trust the system to actually take the screenshot. ...but it doesn't seem to be a notification that I'm able to disable since it is at the system level.
Anybody figure out how to disable this unnecessary notification? Is it just a bug that it can't be disabled?
To reproduce: if you want to take a screen capture hold down the power and down-vol at the same time until the shot is captured, then wait for the little animation and shutter sound letting you know it was captured. After that, you'll get the redundant ding and notification card.

Can I change the device brightness level with Corona SDK?

I was wondering if it was possible to access the device brightness with the Corona SDK, either for iOS or Android. So far my search has turned up nothing.
The reason I'd like to do this is because Corona doesn't support backgrounding, meaning I'd like to fade out the visuals of my app after a certain period of interactivity while continuing to play sound (my app is an ambient noise app).
Thanks -
I would suggest a workaround, that would be to instead add a rectangle on top of the scene with alpha=0, and putting in place a timer or something that periodically checks the player activity, and triggers transition to makes the rectangle alpha go back to 1 (or your wanted 'fading level') whenever the player isn't active for some time.
Whenever the player is active again, just set the alpha back to 0.
Easy done with:
newRect: http://docs.coronalabs.com/api/library/display/newRect.html
timer.performWithDelay: http://docs.coronalabs.com/api/library/timer/performWithDelay.html
transition.to: https://docs.coronalabs.com/api/library/transition/to.html

Android how to use background service to trigger screen rotation

I have a tablet and also I have some test cases want to do.
By triggering screen rotation, I know setRequestedOrientation is a workable api.
However, will it be possible to do it in background service?
Say, can I run the service and look at my home screen to rotate every 1 second?
Thanks for the reply.

Is It possible to set Image as ScreenSaver in Android?

I want to know that Is It possible in Android to set an Image as screenSaver.. I am not sure about the feasibily of screen saver...That is when the phone is Idle, then Instead of showing the black blank screen, my application check the Idle time using OnUserInteraction() method and set an Image as screen saver...?? Please let me know If anybody know about this..
onUserInteraction() is deprecated for a start, and it only listens for events on your Activity.
Secondly, having such a screensaver would require that you use WakeLocks, which consume extra battery. And for a screensaver type app, the battery usage would be extremely high.
You might want to look into Daydreams now, assuming you're fine with Android 4.2 and above only.

Any way to hide Android home screen icons to show Live Wallpaper?

As Android live wallpapers are becoming more prevalent, and developers are doing more with them, a question coming up more and more is how to hide the home screen icons temporarily while the user interacts with the wallpaper.
For this to work, the icons would have to be removed temporarily – not just made invisible, since a tap on an invisible icon would still run the app.
Also, it would be ideal to have a universal solution that works across customs launchers, not just the Android stock launcher.
This question was already asked on StackOverflow, and the answer was that you cannot do this. But this is clearly not correct, as there are at least two programs on Android Market that do exactly this: Show Off (Your Live Wallpaper) and The Cleaner (Show Wallpaper)
Is there a way to hide Android home screen icons, and then later put them back in place?
You can launch an activty which backgroung will be your live walpaper, and finish the activty upon touch... Just a thought...
Edit:
1st comment answer:
Preventing the delay:
You should be more "gentle" in the onCreate() method...
Try creating the minimum as possible in the onCreate(), like, just displaying the basic background...
in the end of the onCreate function, set an alarm (i.e. by AlarmManager) to call some BroadcastReceiver/Activity after half a second or so (with AlarmManager) to set the rest of the live wallpaper graphics... that way you don't have to worry about the delay.
This would have to be a completely new launcher. This is not possible without this I don't think. Sorry. However; to be absolutely sure though you'd have to look at the Launcher2 package in the android source and look through files like Homescreen.java. I'll look into it later on 2.3.3 for you and see what I find.
Try using the zoom gesture as you would to zoom in on a web page (reverse pinch). And you guessed it, the opposite makes everything come back.

Categories

Resources