ロックされているときに他の人がデバイスにアクセスするのを防ぐロック画面アプリケーションを作成します。私はlockscreen活動と呼ばれる活動をしています。ここでのコードは次のとおりです。ホームボタンが押されたときに、そのデバイスがまだロックできるようアンドロイドの上に常にアクティビティを作成するには?
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class LockScreen extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lockscreen);
}
protected void onPause() {
super.onPause();
// it will display a lock screen again when the home button is pressed
Intent myIntent = new Intent(LockScreen.this, LockScreen.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(myIntent);
}
}
そのコードは、リニューアルのためのロック画面のアクティビティを使用しています。私がホームボタンを押してもアプリケーションをタップしなかった場合、5秒以内に再びロックスクリーンのアクティビティが表示されます(アンドロイドの問題に基づいて)が、アプリケーションをタップすると(設定やメッセージなど)、ロック画面のアクティビティは私はそのアプリケーションを閉じます(設定やメッセージは一番上にあり、私のロック画面のアクティビティをカバーしています)ので、デバイスにはまだアクセスできます。 権限のない人からのアクセスを最小限に抑えるために、アクティビティをトップに置く方法を誰にも知られていますか?ありがとう..