0

我有一个在锁定屏幕上显示浮动图标的服务。我想在刷卡锁消失并出现安全锁时立即隐藏浮动图标。目前,我正在收听Intent.ACTION_USER_PRESENT,但系统仅在安全锁消失时发送!

4

1 回答 1

0

您只需要为操作创建一个广播接收器:

<action android:name="android.intent.action.USER_PRESENT" />

广播接收器:

public class SwipeLockMonitorReceiver extends BroadcastReceiver {

@Override
public void onReceive(final Context context, Intent intent) {
    if (Intent.ACTION_USER_PRESENT.equalsIgnoreCase(intent
            .getAction())) {
        // Means the swipe lock gone.
    }
}

}

显现 :

<receiver android:name="SwipeLockMonitorReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
    </receiver>
于 2013-10-16T11:35:29.040 回答