java - Broadcast Receiver declaration in manifest error on intellij -


i'm developing android app using intellij 12.1.4. when create new android component type receiver receiver added manifest as

<receiver android:name=".receiver">     <intent-filter>         <action android:name=" com.example.action_example"/>     </intent-filter> </receiver> 

but giving error "class or interface expected". tried put receiver including package name still same error. project compiles when broadcast sent intent filter associated receiver receiver receives nothing.

any please?

thanks in advance.

you have define intent-filter receiver

       <receiver         android:name="your receiver name">         <intent-filter>             <action android:name="android.intent.action.boot_completed" />              //your action perform on broadcast receiver         </intent-filter> 

after in receiver class have check

        if(intent(object of intent in onreceive method).equals("android.intent.action.boot_completed"))          {            //  action perform         } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -