why BroadcastReceiver don't catch the Action?
<p>Hi I am working on BroadCastReciver. There are two way to define BroadCastReciver.First one is using Java code and Second one is define in AndroidManifest.xml using . In my code second one is don't work properly.please tell where am i goes wrong.</p>

<pre><code>public class HotelReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        String dActionName = intent.getAction();
        Log.i("My Rceiver ", intent.getAction());
        if (dActionName.equals(Intent.ACTION_SCREEN_ON)) {
            Toast.makeText(context, "SCREEN ON", Toast.LENGTH_SHORT).show();
        } else if (dActionName.equals(Intent.ACTION_SCREEN_OFF)) {

        }
    }

} 
</code></pre>

<p>AndroidManifest.xml</p>

<pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.hotelsecurity"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="10"
        android:maxSdkVersion="15" /&gt;
&lt;uses-permission android:name="android.permission.PREVENT_POWER_KEY" /&gt;
    &lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" &gt;
        &lt;activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;receiver 
            android:name=".HotelReceiver"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.SCREEN_ON"/&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;
    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>
