1
嗨我需要显示屏幕时,手机进入睡眠模式,即屏幕关闭模式。我用白日梦,但问题是,它只适用于充电!如何在设备进入睡眠模式(屏幕关闭)时显示屏幕android?
但我的要求是,即使手机进入睡眠模式(没有充电),我需要显示屏幕。
下面是代码,我试过
import android.service.dreams.DreamService;
import android.widget.TextView;
public class MyDreamService extends DreamService {
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
// Allow user touch
setInteractive(true);
// Hide system UI
setFullscreen(true);
// Set the dream layout
setContentView(R.layout.activity_dream);
TextView text = (TextView) findViewById(R.id.textView);
text.setText("Hello DayDream world!!");
}
}
机器人的manifest.xml:
<service
android:name=".MyDreamService"
android:exported="true"
android:label="DayDreams">
<intent-filter>
<action android:name="android.service.dreams.DreamService" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
请您简单介绍一下设备管理api?而且我也不想使用任何第三方应用程序从Playstore进行安装。 – Shadow
因此,如果设备关闭,我可以通过启动电话覆盖屏幕上显示? – Shadow