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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:57:40+00:00 2026-06-10T18:57:40+00:00

So I changed my code to call a broadcast receiver instead of calling the

  • 0

So I changed my code to call a broadcast receiver instead of calling the main activity

Intent notificationIntent = new Intent(context, com.plugin.statusNotificationForGCM.statusNotificationForGCMReceiver.class);

notificationIntent.putExtra(NOTIF_RESPOND, runThis);
notificationIntent.setAction(Intent.ACTION_VIEW);
notificationIntent = notificationIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

//contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

The problem is I added this in my receiver, but don’t think its running. Don’t see the tag and Log in the console when I click the notification

public class statusNotificationForGCMReceiver extends BroadcastReceiver {
    private static final String TAG = "statusNOTIFICATIONReceiver";

    @Override
    public final void onReceive(Context context, Intent intent) {
        Log.v(TAG,"ASDFSJD FASDF ASDPFJA SDFPAUS DFPAS DFASDF");
    }
}

Is there something I am missing? Do I have to add something to the manifest file?

Thanks

  • 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-10T18:57:42+00:00Added an answer on June 10, 2026 at 6:57 pm

    You may need to have this in manifest :

    Suitable intents are defined in its <intent-filter>

    <activity android:name="BroadcastIntents" android:label="@string/app_name"/>
        <receiver android:name="statusNotificationForGCMReceiver" android:label="@string/app_name">
           <intent-filter>
              <action android:name="android.test.BROADCAST" />
           </intent-filter>
        </receiver>
    

    Addenda:

    an intent filter lets you tell an activity what it can/cannot respond to (when called by intent).

    public class InternalMessageReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context ctx, Intent intent) {
            String msg = intent.getStringExtra("message");
            Toast.makeText(ctx,msg,Toast.LENGTH_SHORT).show();
        }
    }
    

    You can call it in an Activity for instance for a button clicked like this:

    private static final String ACTION = "android.test.BROADCAST";
    
    public void onClick(View v) {
            /* Broadcast intent */
            Intent intent = new Intent(ACTION);
            intent.putExtra("message", msg);
            main_activity.sendBroadcast(intent);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a snippet of code that I'm calling from a service: context.registerReceiver(new BroadcastReceiver()
This code will call the method defaultsChanged, when some value in UserDefaults changed NSNotificationCenter
I had a folder with ROR code lets call it subfolder under main folder
I changed the code shown below into ARC compatible. I just changed it as
I have the following code (changed object names, so syntax/spelling errors ignore). public class
This code used to work. Then, maybe I changed something, somewhere (or if I
I wrote some code today and It was changed by another developer who said
I have changed a lot of things in a java code but now I
This code was working earlier today, then randomly stopped, something must of changed, but
The other day this code was working. I changed some things and re-ran it

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.