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 8587101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:29:03+00:00 2026-06-11T22:29:03+00:00

I have some problems. I want to transfer messages. I use context.sendBroadcast to send

  • 0

I have some problems. I want to transfer messages. I use context.sendBroadcast to send and BroadcastReceiver – to receive messages

public class GPS_module implements LocationListener {

private Context context;

public GPS_module(Context ctx) {
        context = ctx; 
        manager = (LocationManager) context
                .getSystemService(Context.LOCATION_SERVICE);

    }
.....

 public void sendMessage(String str) {
       Intent intent = new Intent("logGPS");
       intent.putExtra("Message",str);
       context.sendBroadcast(intent);
} 

}

for receiving messages I use the following source code

public class Fragment_1 extends Fragment{
    .......
    @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {

            View myFragmentView = inflater.inflate(R.layout.right_panel_1, null);

            BroadcastReceiver log = new BroadcastReceiver() {
                @Override
                public void onReceive(Context context, Intent intent) 
                {
                    if(intent.getAction().equals("logGPS"))
                    {
                        myLog(intent.getStringExtra("Message"));

                    }
                }
            };

            return myFragmentView ;

          }
    }
  • 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-11T22:29:05+00:00Added an answer on June 11, 2026 at 10:29 pm

    You need to do something like:

    (This is for Connectivity)

       registerReceiver(myReceiver,
               new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    

    You need to register and set an intent filter.

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

Sidebar

Related Questions

We have regional office and some data in this office.We want to transfer data
I have some problems with some customers, in my application I use Simple MAPI
I have some problems with displaying some Arabic text in my iPhone application. When
I want some help on a way to transfer data from a python web
I have a .txt file that logs some information. I want to load it
I have a problem, when I want get some data from CSV file to
I have some problems trying to custom the :path and :url options for has_attached_file
I want to ask, why I cannot transfer file from server to client? When
Hello every one I want to ask a question about file transfer using sockets.
I have a textfile that I am I want to make into a list.

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.