I had gone through many solution available online but I didn't fine appropriate.
Basically i wanted to utilize following parameters using service
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
I have gone through one of the references are there anybody know how to getWindow() in service on android?
if(mConfiguration.orientation==Configuration.ORIENTATION_LANDSCAPE){
mLayoutParams.screenOrientation=Configuration.ORIENTATION_PORTRAIT;
}
mLayoutParams.softInputMode=WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN;
mLayoutParams.gravity = Gravity.TOP|Gravity.CENTER;
int flag=0
|WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
|WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
;
mLayoutParams.flags=flag;
mWindowManager.updateViewLayout(mRootView, mLayoutParams);
In the above code how to utilize the rootview in service?
Looking forward to hearing from you soon.
The variable
mRootViewrefers to the view which was added to theWindowManager.Lets say you have added a view
myViewto theWindowManagerlike this:Now you can update the LayoutParams of
myViewwith theupdateViewLayout-method: