android - Can a service receive its own broadcasts? -


if had service called myservice , looked this, service's broadcastreceiver recieve own broadcast "senddata" method ??

what asking is there going problem if used same intentfilter constants.service of broadcast receiver intent action send broadcasts activity ?

myservice.java

public class playerservice extends service {     private ffmpegmediaplayer mp;     private broadcastreceiver receiver;      @override     public void oncreate() {         super.oncreate();         ...         registerreceiver(receiver, new intentfilter(constants.service));         ...     }     ...     public void senddata() {         intent intent = new intent(constants.service);         sendbroadcast(intent);     } } 

as adil soomro , rupesh jain mentioned apparently won't problem service cannot receive it's own broadcasts.

edit

actually after experimenting found service can receive own broadcasts if broadcastreceiver had same intentfilter broadcast intent.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -