Question

This IntentService (NotificationService in the snippet) isn't getting started and doesn't receive those Intents. By registering a receiver for them in the Application class, I've verified that those Intents are being broadcast. I just want to get them when the app isn't started.

    <service
        android:name=".services.NotificationService">
        <intent-filter>
            <action android:name="com.redactedtoprotecttheinnocent.ACTION_INCOMING_CALL"/>
            <action android:name="com.redactedtoprotecttheinnocent.ACTION_CALL_STATUS_CHANGE"/>
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </service>

Any suggestions for what might be wrong here? I'd rather not create a broadcast receiver just to start an IntentService.

Was it helpful?

Solution

Any suggestions for what might be wrong here?

You appear to be thinking that services are started automatically by broadcast Intents, which is not the case.

I'd rather not create a broadcast receiver just to start an IntentService.

Well, you are welcome to rewrite the code that is sending com.redactedtoprotecttheinnocent.ACTION_INCOMING_CALL and com.redactedtoprotecttheinnocent.ACTION_CALL_STATUS_CHANGE broadcasts, so that they stop sending broadcasts, and instead use startService() to send commands to your service. If this code is not yours, though, changing it may be difficult.

Or, you can have a short manifest-registered BroadcastReceiver that turns around and calls startService() to have the service process the broadcasts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top