I a’m trying to make a android flash light apps.
In this apps have flash light on off switch, but i am trying to make it professional for this reason i added an extra features Shake Service . That’s means when user will click shake service button then Gravity/Accelerometer Sensor will be enable (I don’t know what sensor should i use for this service), then when user will shake her device then Flash light will be on (So far I have completed) and again if user shake her device then flash light will be off. main fact is I can not do this last option.
for your better understanding please see the below block, Kindly share with me a better suggestion how can i complete it.
Store the flashlight status in a boolean variable. If the flashlight was turned on, turn it off when Accelerometer.Shaking.
thanks for reply,
i can’t do it due to i am not getting any others block as like your suggestion,…
Please share with me the block as a image…
initialize global flashlight_status to false
if global flashlight_status
call (turn off)
set global flashlight_status to false
call (turn on)
set global flashlight_status to true
Why don’t you try to translate the solution from @Kanishka_Developer into blocks language?
It is pretty easy and too a good learning stuff.
Thanks a lot @Kanishka_Developer i have succeed as per your suggestion…
Thanks again yaar
I’m attaching the demo APK and AIA with added functionality, for future reference.
Flashlight_Demo.apk (3.7 MB)
Flashlight_Demo.aia (9.5 KB)
This material is unlicensed as of now, and open-source. This can be used with acknowledgement to me and a link to my website kanishkadeveloper.wordpress.com in the app, easily viewable by users.
Something went wrong with this demo.apk
when i’m shaking my device then flash light doing on off, on off, automatically.
For your better understanding please you can check it your own device.
I checked on my device before uploading.
It’s a problem with your phone’s sensor then.
Try changing the sensitivity or the delays.
Everything is okay, but if is it possible to do, when user will use shake service if user minimize this apps then keep running apps in notification bar with a message as like your apps is running.
That you’ll have to figure out on your own. I don’t have a OneSignal API.
Check out the app with just modification of shake app
It’s looks nice but improve more design of your app
If you modified my source code, could you credit me in your app?
your code is no longer visible for download