Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6624687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:41:02+00:00 2026-05-25T21:41:02+00:00

i make a lock screen application that prevent other people to access the device

  • 0

i make a lock screen application that prevent other people to access the device when it’s locked. i have an activity called lockscreen activity. here’s the code:

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);
        }
    }

that code is used for relaunch the lockscreen activity when home button pressed, so that device can still locked. if i press the home button and didn’t tap any application, it will show that lockscreen activity again within 5 second (based on android issue), but if i tap any application (eg: setting or messages) my lockscreen activity will shown after i close that application (the setting or messages is on the top and cover my lockscreen activity) so the device still can be accessed.
has anyone know how to make an activity stay on top for minimize the access from unauthorized people? thanks..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:41:02+00:00Added an answer on May 25, 2026 at 9:41 pm

    I’m not so sure that is possible to make an app stay on top always like that. And what are you going to do when they push the home button? Or what if they run Cyanogen and hold the back button to “kill” the app? It doesn’t sound like an effective way to make a lock screen. Perhaps you can look at some of these other questions that are kinda similar. I just think that there must be a better way to implement a lock screen app.

    Source of Android's lock screen

    This link tells you how to find the android source code online
    Where can I find Android source code online?

    And this is the actual link of where the LockScreen.java is located
    https://github.com/android/platform_frameworks_policies_base/blob/master/phone/com/android/internal/policy/impl/LockScreen.java

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i make a lock screen application.. i have some service that listen to the
I'm trying to build an application that needs to lock down access to the
I want to make a lock screen application. When the phone is in the
I'd like to make my app use the audio buttons on the lock screen
I'm making a custom lock screen. The lock screen is an activity which I
Possible Duplicate: License for C# desktop application I want to make my program lock
It needs to create instant messenger application. Background thread should work under lock screen
In my application I need to make a lock on some rows when those
How do you launch an activity when the lock screen is enabled? I want
I'm using DevicePolicyManager to make an app that can lock devices and was wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.