Java Code Examples for

The following are Jave code examples for showing how to use wakeUp() of the class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: smart-lens   File:   Source Code and License Vote up 9 votes
public void setup() {
    // Unlock the screen if it's locked
    UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    try {
    } catch (RemoteException e) {

    // Set the flags on our activity so it'll appear regardless of lock screen state
    new Handler(Looper.getMainLooper()).post(() -> {
        if (getActivity() == null) return;
        getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
Example 2
Project: bluesnap-android-int   File:   Source Code and License Vote up 5 votes
public void wakeUpDeviceScreen() throws RemoteException {
    UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
    ActivityLifecycleMonitorRegistry.getInstance().addLifecycleCallback(new ActivityLifecycleCallback() {
        public void onActivityLifecycleChanged(Activity activity, Stage stage) {
            //if (stage == Stage.PRE_ON_CREATE) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
            // }