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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:48:17+00:00 2026-05-21T02:48:17+00:00

I want to run a method CippaLippa() in the GmailService class when I receive

  • 0

I want to run a method CippaLippa() in the GmailService class when I receive an email in Gmail client.

I’ve a receiver and a service in AndroidManifest…

    <receiver
        android:name="com.myapp.receiver.GmailReceiver">
        <intent-filter>
            <action
                android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <service
        android:name="com.myapp.service.GmailService"
        android:label="@string/app_name" />

and these classes…

public class GmailReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(final Context context, final Intent intent) {


        final SharedPreferences preferences = context.getSharedPreferences("myapp.prefs", 0);

        context.startService(new Intent(context, GmailService.class));
    }
}


public class GmailService extends Service { .. etc...}

My question: everything works right for some hours and when I receive a notification from Gmail, the CippaLippa() method fires… then, after some hours, when I receive a gmail notification, the CippaLippa() method fires no more.

Maybe, there is a way to tell GmailService class to “stay alive” and continue monitoring Gmail events? I think this is not due to Android OS that kills unused classes, because that is a background service and not an Activity.
I’ve no clue.

  • 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-05-21T02:48:17+00:00Added an answer on May 21, 2026 at 2:48 am

    You’re right about the system killing the service. I’ve had the same problem with a service associated with a widget.
    I solved it by making it refresh every 30 minutes or so.

    So if you schedule some event once in a while to wake up your service, it should stay up and running.

    There might be a better solution though.

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

Sidebar

Related Questions

I want to run a method periodically in an android activity which updates a
i want to run a method in servlet when client finished onload webpage without
I have a static class that has a method hello. I want to run
Suppose I want to run the following method foo() once every hour in Grails:
I want to run SearchResultByOrderNumber(string orderNumber) method in Foreach with multithreading. There are ten
I want to write a method that run multiple threads and I want before
I just want that my program or method should run at specific date and
I want a simple C method to be able to run hex bytecode on
Thread class has run method to implement the business logic that could be executed
Can you run a test for a single method only, not a whole class?

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.