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

  • Home
  • SEARCH
  • 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 8310243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:23:24+00:00 2026-06-08T19:23:24+00:00

Uri uriSMSURI = Uri.parse(content://sms/inbox); Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null); int i=0; while

  • 0
        Uri uriSMSURI = Uri.parse("content://sms/inbox");
        Cursor cur = getContentResolver().query(uriSMSURI, null, null, null,null);
        int i=0;
        while (cur.moveToNext()) {
            Phone_no=cur.getString(2);
            Time=cur.getLong(4);
            Message_body=cur.getString(11);
            Date dateObj = new Date(Time);
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd:HH:mm:ss");
            String Timenew = df.format(dateObj);
            Log.d(Tag,"INSIDE OF READ SMS INBOX");


           service.setClass(getBaseContext(), Background_Service.class);
           service.putExtra("Phone_no", Phone_no);
           service.putExtra("Message_body", Message_body);
           service.putExtra("Timenew", Timenew);
           getBaseContext().startService(service);
           } 

the above code read the message from the inbox. And i send those message to the service for further processing. Is this the right way to do. Should i create a queue for the service execution, if so how to create, implement a queue to the above code.

  • 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-08T19:23:26+00:00Added an answer on June 8, 2026 at 7:23 pm

    Yes, it is applicable way.
    But, i prefer another one.

    Instead of starting a new service and routing new intents to it, you can create service once and bind to it, and send Messages to it.

    First of all you need a messaging protocol. The easiest way it is create AIDL file with similar content.

    package org.your.pkg;
    
    interface IBackgroundService {
      void queueMsg(String phoneNo, String msgBody, String timeNew);
    }
    

    And then, you must implement it in your service.

    class BackgroundService extends Service {
    
      IBackgroundService.Stub binder = new IBackgroundService.Stub() {
        public void queueMsg(String phoneNo, String msgBody, String timeNew) {
          // enqueue message to service thread. Do not process msg in this method.
        }
      };
    
      public IBinder getBinder() {
        return binder;
      }
    }
    

    And then, you must connect to your service.

    private ServiceConnection mConnection = new ServiceConnection() {
        public void onServiceConnected(ComponentName className, IBinder service) {
            IBackgroundService yourService = IBackgroundService.Stub.asInterface(service);
    
            // calls to yourService.queueMsg(...)
        }
    
        public void onServiceDisconnected(ComponentName className) {
            Log.e(TAG, "Service has unexpectedly disconnected");
        }
    };
    

    There are more on this topic.

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

Sidebar

Related Questions

i wrote the simple code ContentResolver contentResolver = this.getContentResolver(); Uri uriSMSURI = Uri.parse(content://sms/); //
Uri mmsUri = Uri.parse(content://media/external/images/media/1); Intent intentMMS = new Intent(Intent.ACTION_SEND); intentMMS.putExtra(sms_body, Hi how are you);
Hello i am created Sms app witch shows me content of Inbox.I am using
I have a content observer that polls content://sms/ in android 1.5 so that I
Uri uri = Uri.parse(com.dynamixsoftware.printershare.print); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(uri); intent.setPackage(com.dynamixsoftware.printershare.print); intent.setType(application/pdf); startActivity(intent);
When using contentResolver.delete(uri, null, null) then determining success can be done by looking at
Simple: Uri uri=Uri.parse(geo:+_lat+,+_lon); startActivity(new Intent(Intent.ACTION_VIEW, uri)); startActivity() crashes my app (I know why). So,
Uri uri = new Uri(redirectionUrl); NameValueCollection col = HttpUtility.ParseQueryString(uri.Query) uri.Query is already decoded -
i have got ListView of Inbox SMS.I am trying, if i click on any
Uri imageFileUri = context.getContentResolver().insert( Media.EXTERNAL_CONTENT_URI, new ContentValues() ); Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,

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.