首页 新闻 会员 周边 捐助

android 自定义屏保问题

0
悬赏园豆:10 [待解决问题]

private void ScreenSaverMethod() {
// 关闭系统屏保
mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
mKeyguardLock = mKeyguardManager.newKeyguardLock("");
mKeyguardLock.disableKeyguard();
// 注册receiver:
BroadcastReceiver mMasterResetReciever = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
try {
Intent i = new Intent();
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setClass(context, MyScreenSaver.class);
context.startActivity(i);
// finish();

} catch (Exception e) {
Log.i("Output:", e.toString());
// e.printStackTrace();
}
}
};
registerReceiver(mMasterResetReciever, new IntentFilter(
Intent.ACTION_SCREEN_OFF));
}

mainfest.xml 配置 <uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>
屏保在真机上怎么运行不起来啊,
求解啊,在模拟器上按电源键能用起来,,那在真机上,屏幕暗下来了,就没有反映了

shenggen的主页 shenggen | 初学一级 | 园豆:187
提问于:2011-03-12 12:38
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册