We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Detailed description You will create an application program to monitor. ( at app.)
For example,
To summarize, I want my smartphone to work even when it is turned off.
I need your help. Please help me.
Answers
@Gwak===
sorry but if your phone is turned off (not in stand by or pause) not any event is captured till the user starts it again
He probably doesn't mean 'off'.
This is obviously an assignment.
@koogs===
you re probably right but i don't understand what he means...i see a black screen with written SYSTEM OFF; is he speaking about "screen black" , is he speaking about "sleep mode" ???
@akenaton -- Gwak surely means sleep mode by this.
@Gwak -- I am not an Android developer, but I believe that Sleep mode only wakes on alarms -- not network messages.
You may want a "wakelock".
@jeremydouglass===
ok; it seems more possible (using alarm manager or phone ringing or sms) BTW wakelock is not "sleep mode".
@akenaton -- that's right, wakelock is not sleep mode. @Gwak requested:
As for as I can tell, sleep mode only wakes on alarms -- not network messages. So I thought perhaps wakelock might work instead, as then the program can receive network messages because it is not in app sleep. But I am not an Android developer -- perhaps this is wrong.
@jeremydouglass=== you are right; if @Gwak wants to receive messages (not only from AlarmManager) wakelock is the best solution.
@akenaton, @koogs, @jeremydouglass, Very thanks.
@akenaton (wakelock is the best solution.) Can you tell me some coding examples through processing? please.
What I want is not a primitive principle. I want to make the following through processing. That is, you need to know if it is possible and sample code. please. Thank you very much for your interest.
@Gwak=== what kind of event is supposed to awake the phone?
@akenaton
Thank you for your quick reply.
-. Example: Message alarm at 1 pm ( Sample code for this event. )
Thanks.
@Gwak
I think the most important part to know here is what kind of events will wake up your phone. The more specific details you provide, it is very likely you will get a more specific answer. Right now it is not clear if your event is trigger by a clock alarm-like event, or SMS, or internet events.
@jeremydouglass From my limited experience, wakelock is used to keep the screen on. I am not sure if this is suitable for this challenge as it has to be called by the application meaning that the application must be running. @akenaton, expanding from your previous response, how would you use wakelock in this case?
I think what he wants is to have the application running in the background monitoring for certain events that will cause the application to come to the foreground. Interesting challenge. These might be a start:
http://stackoverflow.com/questions/9029040/how-to-run-an-android-app-in-background
https://developer.android.com/training/run-background-service/index.html
https://developer.android.com/training/run-background-service/create-service.html
Kf
@kfrajer
Thank you for your interest. If you look at your link, it's information you use on Android. Is this possible in Eclipse?
Is it possible through processing? Do you want to put it into the link source?
I want to make it through a processing tool, please help me.
@kfrajer===
semantics problem! wakelock is the name for the general flag in the powerManager but you have choice between 4 flags::
https://developer.android.com/reference/android/os/PowerManager.html#goToSleep(long)
from them i think that the best one in @Gwak case is PARTIAL, because that means that the screen is off but CPU is running and that at any moment some event can be captured (alarm manager) which awakes the screen (releasing the wakelock)
@Gwak=== now i understand what you want; only onequestion: when the app starts what is the screen state??? Turned off?? Or turned off after some event???
@akenaton
turned off is mean => display off, (button)
Could you give me a sample code?
@Gwak===
2 solutions for that:
first one: with on mouseReleased() you call WindowManager.LayoutParams params = getActivity().getWindow().getAttributes();
and set the screenBrightness to 0;
this is the more simple and not draining battery method
second one:
using PowerManager API and PARTIAL_WAKE_LOCK (you launch that from mouseReleased eg) acquire. the screen turns black; CPU is always running; in order to awake your phone you use AlarmManager.
More complicated and draining battery;
You have to add onPause() && on Resume() with wakeLock release; Have also to add permissions (WakeLock)
@akenaton Easy explanation Thank you.
Can you write the whole sample code? I need some example code. (Please write the code as an example. It's the whole story so it can be executed.)
Please help me. Thank you very much.
@Gwak
Do you code your programs in Processing, Eclipse or AS? I believe if you work in eclipse or AS, you can find more code available on the web related to your challenge. I have limited experience with the Android API and Android libraries in Processing are more of a hit and miss: sometimes you find what you need or sometimes it needs to be implemented using native code.
Have you attempted any code from the links I provided you?
Kf
@kfrajer
I can use Eclipse briefly.
But I want to solve it through a processing program. Is the data you sent possible with processing?
If possible, I want to get an example source for that.
@Gwak===try to write your own code from my hints (or in your way) then i can help.
@akenaton, @kfrajer
Thank you very much for your first comment.
However, there is a reason I want sample samples. You do not think of me.
I did not ask if you could apply the code right away.
The reason I requested the example code is because it is hard to get the answer you gave.
I want the example code to be what I want.
I would appreciate it if you understood.
Moved here
https://forum.processing.org/two/discussion/21298/please-help-me-smartphone-is-related-to-screen-control
Closing this.