Hi There are two ways to define BroadCastReciver I'm working on BroadCastReciver. The first is using a Java code and the second Android manifest. My code is not working properly in another. Please tell where I am wrong.
Public category hotel receivers extend broadcasts receivers {@ but relevant references (reference references, intention intent) / TODO auto generated method stub string dActionName = intent.getAction (); Log.i ("my receiver", intent .getAction ()); If (DAPNAGAZELS (Intent.ACTION_SCREEN_ON)) {TOST.MATET TEXT (REFERENT, "SCREEN ON", TOST., LNNGHIHORT). Show (); } Else if (dActionName.equals (Intent.ACTION_SCREEN_OFF)) {}}} AndroidManifest.xml
& lt; Manifest xmlns: android = "http: //schemas.android.com/apk/res/android" package = "com.example.hotelsecurity" android: versionCode = "1" Android: versionName = "1.0" & gt; & Lt; Use-sdk android: minSdkVersion = "10" Android: targetSdkVersion = "10" Android: maxSdkVersion = "15" /> & Lt; Usage-permission Android: name = "android.permission.PREVENT_POWER_KEY" / & gt; Android: Android: Android: Android: Android: Theme = "@ Style / Aaptim" & gt; & Lt; Activity Android: Name = "main activity" Android: label = "@ string / title_activity_man" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & 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" /> & Lt; / Intent-Filter & gt; & Lt; / Receiver & gt; & Lt; / Application & gt; & Lt; / Reveal & gt;
I think your receiver should be read
& Lt; Receiver Android: name = "HotelReceiver" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.SCREEN_ON" /> & Lt; / Intent-Filter & gt; & Lt; / Receiver & gt; not dot "."
No comments:
Post a Comment