Android Lock Android ICS

I searched the last 2 days on SW, google and so on. I am looking for a way to implement the activity that comes with the built-in Android ICS lockscreen, as shown in the screens below. These screens come from Player Pro , but I noticed that other players ( PlayerPro ) have the same function that looks exactly the same, so I think this is something native, or at least there is a general way to implement it .

So far, I have managed to get Activities that replace the lockscreen using these flags:

  • WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
  • WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD

using BroadCaseReciever for these events:

  • Intent.ACTION_SCREEN_ON
  • Intent.ACTION_SCREEN_OFF
  • Intent.ACTION_USER_PRESENT

My problem is that I want my activity to show with lockscreen without replacing it. Do you guys know how to achieve this?

is there a tailored hidden API?

Can you guys tie me a pattern that implements this particular function?

early;)

enter image description hereenter image description hereenter image description here

+6
android lockscreen
May 29 '12 at
source share
2 answers

I think you can look for the Remote Control (RemoteControlClient) Audio Controls API added in Android 4.0 (API level 14). I found the RemoteControlClient API in the Android developer docs that:

allows you to display information intended for consumption using a remote control that can display metadata, cover and media buttons for transport control.

(He was linked to this page .)

Note. I have never used this API myself, so I apologize if this does not work for you.

+7
Jun 08 2018-12-18T00:
source share

You do almost everything right. Keep doing what you do with BroadcastReceiver. This is the way. For Window, these are the flags you should use:

  • WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
  • WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL

Use not FLAG_DISMISS_KEYGAURD

What these flags do: SHOW_WHEN_LOCKED allows your activity to appear on top of the lock screen. FLAG_NOT_TOUCH_MODAL allows touch events that are not part of your activity to go to other actions, i.e. Allows the user to unlock the screen. FLAG_DISMISS_KEYGUARD gets rid of the lock screen, so we do not use it.

Define this style in res / values ​​/styles.xml

 <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.FloatingTranslucent" parent="android:Theme.Translucent.NoTitleBar"> <item name="android:windowIsFloating">true</item> </style> </resources> 

In the manifest, define the style of your activity

 <activity android:name=".SampleActivity" android:theme="@style/Theme.FloatingTranslucent"> ... </activity> 

This means that your activity is fully viewing and transferring content.

Now your activity should be on top of the lock screen, allowing touch input on the lock screen and in your application, while your activity will not be complete.

Greetings.

+1
Jun 05 2018-12-12T00:
source share



All Articles