Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7938851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:55:25+00:00 2026-06-03T22:55:25+00:00

This is my service file: public class SMSCounterService extends Service { /** Called when

  • 0

This is my service file:

public class SMSCounterService extends Service {
    /** Called when the activity is first created. */
    @Override
    public void onCreate() {
        Log.d(LOG_TAG, "SMSCounterService: Constructor");
        super.onCreate();
        dbActivities = new DBActivities(this);
        dbActivities.open();    // Create or open the existing DB if already created

        IntentFilter filter = new IntentFilter();
        filter.addAction("android.provider.Telephony.SMS_SENT");
        registerReceiver(receiver, filter);
    }

    @Override
    public void onDestroy() {
        unregisterReceiver(receiver);
        dbActivities.close();
        super.onDestroy();
    }

    private final BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if(intent.getAction().equals("android.provider.Telephony.SMS_SENT")) {
                smsCount++;
                Log.d(LOG_TAG, "SMSCounterService: smsCount=" +smsCount);
                long dbInsertReturn = dbActivities.insertIntoDB(smsCount);
            }
        }
    };

I can see the log “SMSCounterService: Constructor”. So the onCreate() method is called. But when I send an SMS, the BroadcastReceiver is not able to identify it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:55:26+00:00Added an answer on June 3, 2026 at 10:55 pm

    AFAIK, there is no intent like android.provider.Telephony.SMS_SENT.
    I did “grep” through Ice Cream Sandwich and couldn’t find it.

    Go with ContentObserver approach. Register your observer to listen to updates messaging provider.
    (Decided to register it as an answer, who knows maybe somebody will accept it 😉 )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following windows service file: Imports System.ServiceProcess Imports System.IO Public Class fswService
PLEASE HELP ME TO SOLVE THIS ERROR cs file public partial class Control :
I have this code in a single file : public class genIntro { public
I am implementing notification my app just example. Service class file: public class Services
I've created a WebService like this: [WebService(Namespace = http://ns)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class
I has class like this: @Service(userDetailsService) public class MyUserDetailsService implements UserDetailsService { ... and
I want to start a service using BroadcastReceiver with this code public void onReceive(Context
I have a Windows service built upon ATL 7's CAtlServiceModuleT class. This service serves
Im having trouble working grabbing a dynamically created image from this service: http://opsin.ch.cam.ac.uk/opsin/USER-STRUCTURE-TO-GENERATE.png Im
I'm creating a mediaplayer service to play a media file from internet, like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.