Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid.intent.action.SCREEN_ON doesn't work as a receiver intent filter
    primarykey
    data
    text
    <p>I'm trying to get a BroadcastReceiver invoked when the screen is turned on. In my AndroidManifest.xml I have specified :</p> <pre><code> &lt;receiver android:name="IntentReceiver"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.SCREEN_ON"&gt;&lt;/action&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre> <p>However it seems the receiver is never invoked (breakpoints don't fire, log statements ignored). I've swapped out SCREEN_ON for BOOT_COMPLETED for a test, and this <em>does</em> get invoked.</p> <p>This is in a 1.6 (SDK level 4) project.</p> <p>A Google Code Search revealed this, I downloaded the project and synced it, converted it to work with latest tools, but it too is not able to intercept that event.</p> <p><a href="http://www.google.com/codesearch/p?hl=en#_8L9bayv7qE/trunk/phxandroid-intent-query/AndroidManifest.xml&amp;q=android.intent.action.SCREEN_ON" rel="noreferrer">http://www.google.com/codesearch/p?hl=en#_8L9bayv7qE/trunk/phxandroid-intent-query/AndroidManifest.xml&amp;q=android.intent.action.SCREEN_ON</a></p> <p>Is this perhaps no longer supported?</p> <p>Previously I have been able to intercept this event successfully with a call to Context.registerReceiver() like so</p> <pre><code>registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // ... } }, new IntentFilter(Intent.ACTION_SCREEN_ON)); </code></pre> <p>However this was performed by a long-living Service. Following sage advice from CommonsWare I have elected to try to remove the long-living Service and use different techniques. But I still need to detect the screen off and on events.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload