lockscreen

Keep notification on lock screen

时光总嘲笑我的痴心妄想 提交于 2019-12-13 19:51:04
问题 How can I keep the notifications from my app on the lockscreen, until the user has interacted with it? What I mean is, even if the user unlocks the phone and than locks it again, I would like to have the notification show up again and again on their lockscreen until they finally taken an action with it. The iOS Reminders app is a great example. Thanks! 回答1: until they finally taken an action with it this would be annoying to the user to say the least. First you need a way to know if the user

Android disable all hardware keys for lockscreen app

≯℡__Kan透↙ 提交于 2019-12-13 18:30:28
问题 I am coding a custom lockscreen app for android. I have managed to disable the back button. But the home button and the recent apps button on ICS proved not to be as easy. I searched around and came up with: @Override public void onAttachedToWindow() { // TODO Auto-generated method stub this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); } However, this throws IllegalArgumentException window type can not be changed after it is added. I then tried to

How to block home button on Android 4.4?

佐手、 提交于 2019-12-13 07:33:00
问题 On Android 4.4 I develop a lockscreen app, but in lockscreen activity I can't block home button. Can anyone solve it? 回答1: Override the onKeyDown function of the activity and then catch the event for the home button. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_HOME)) { Toast.makeText(this, "You pressed the home button!", Toast.LENGTH_LONG).show(); return true; } return super.onKeyDown(keyCode, event); } 来源: https://stackoverflow.com

Activity of android above default lock screen using unity c# scripts

浪尽此生 提交于 2019-12-13 01:06:56
问题 how i can add WindowManager 's LayoutParams flag inside unity c# scripts. For example i can do it in Android by code as follow. getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); 回答1: you can do that like this: AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>(

Launch activity when user taps on a notification from the lockscreen

大憨熊 提交于 2019-12-12 17:06:35
问题 I want to be able to tap on a notification when the device is locked and launch an activity without unlocking the device. I added some flags to the activity in the onCreate() method that allow the activity to be displayed when the device is locked: Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); window.addFlags

How to disable naviagation bar in Android LockScreen App like CM locker and OS8 lock screen

自作多情 提交于 2019-12-12 10:25:35
问题 I tried setting systemUIView(View.GONE) and use Immersive Full-Screen Mode. But users can always get the naviagtion bar back by touching the bottom of the screen. The apps i mentioned above are able to hide it without root or setting default launcher. 回答1: Okay, I found a solution finally and here is how it's done: Use SYSTEM_UI_FLAG_IMMERSIVE_STICKY to hide the navigation bar as follow, you may put the code inside onResume of your activity View decorView = getWindow().getDecorView(); int

How to know whether the phone is locked mode

拟墨画扇 提交于 2019-12-12 09:53:12
问题 HI guys is there a way for me to know whether the phone is in lock state? 回答1: Have your app listen our for the ACTION_SCREEN_OFF broadcast. More information here. public class ScreenReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { //screen locked } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { //screen unlocked } } } You might also want to receive information of

How to Display Toast on Lock Screen after Failed Password Attempt

Deadly 提交于 2019-12-12 05:14:32
问题 I am trying to show a Toast on the lock screen after a user enters the wrong password 3 times. I am able to verify that the user has failed 3 times through the log console, but would like some message to show on the lock screen so the user knows. I am doing this in a DeviceAdminReceiver. I am able to Toast on a successful password submission, just not a failed one. import android.app.admin.DeviceAdminReceiver; import android.app.admin.DevicePolicyManager; import android.content.ComponentName;

error when starting lockscreen android project

回眸只為那壹抹淺笑 提交于 2019-12-12 04:48:41
问题 I'm making a screen lock Button in a Fragment. Via this example: http://karanbalkar.com/2014/01/tutorial-71-implement-lock-screen-in-android/ My code: public class Tab1fragment extends Fragment implements View.OnClickListener{ private static final int ADMIN_INTENT = 15; private static final String description = "Sample Administrator description"; private DevicePolicyManager mDevicePolicyManager; private ComponentName mComponentName; @Override public View onCreateView(LayoutInflater inflater,

Notifications in Moto Display

倖福魔咒の 提交于 2019-12-12 03:28:44
问题 I created a notification and it works but not display in Moto Display when locked. I changed Priority, Category etc with no effects. I want this notification like messages or missed cals: moto display This runs as a service: PendingIntent pendingIntent = PendingIntent.getActivity(this, requestCode /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.emblem2) .setLargeIcon