[英]ContactDetailActivity from Lockscreen Activity
I have created a lockscreen widget that starts a custom activity when a click is performed on it. 我创建了一个锁屏窗口小部件,当单击该窗口小部件时将启动自定义活动。 This activity displays a few predefined user selected contact names.
此活动显示一些预定义的用户选择的联系人姓名。 When the user click on one of these names, I would like to display contact's information.
当用户单击这些名称之一时,我想显示联系人的信息。
Since I have the contact ID when I click on the contact display name, I use an intent to redirect to the builtin ContactDetailActivity by using the following piece of code: 因为当我单击联系人显示名称时我具有联系人ID,所以我使用一种意图通过以下代码重定向到内置的ContactDetailActivity :
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri =
Uri.withAppendedPath(
ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactId));
intent.setData(uri);
intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
The problem is that I have to unlock the screen to see the contact activity that displays information. 问题是我必须解锁屏幕才能查看显示信息的联系人活动。 I think the problem is due to the fact that I haven't specified flag WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED for
ContactDetailActivity
, however I cannot figure out how to do nor if it is possible? 我认为问题是由于我没有为
ContactDetailActivity
指定标志WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED而引起的,但是我不知道该怎么办,或者是否有可能?
Is there a simple mean to achieve my purpose. 有没有简单的方法可以实现我的目的。 Otherwise, the last solution I see is to create a custom activity that behaves like
ContactDetailActivity
so that I can put the WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
flag. 否则,我看到的最后一个解决方案是创建一个行为类似于
ContactDetailActivity
的自定义活动,以便可以放置WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
标志。 However, it seems overkill. 但是,这似乎太过分了。
why you don't use QuickContactBadge
instead ? 为什么不改用
QuickContactBadge
? here android has good tutorial in how to use it Android Displaying the Quick Contact Badge android在这里有如何使用它的很好的教程android显示快速联系徽章
在使用FLAG_DISMISS_KEYGUARD
启动活动时,为什么不解雇键盘锁?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.