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 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

i want to use .animate function but i have some problems i want to
I have some problems when I want to use implicit methods to convert a
I got some problems in Datagrid WPF I have a datagrid, and I want
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 problem. Dialog.dismiss() does not work. I want to input ip, username,
I want to persist my entity with ManyToMany relation. But i have some problem
I have some kind of problem with jQuery selectors. Let's say i want to
my problem is: I have an image and want to mark some areas over
I have one problem , I want to get some data from XML file

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.