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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:46:54+00:00 2026-06-13T15:46:54+00:00

I have an Android application with the following logic of activities execution: if FIRST_RUN

  • 0

I have an Android application with the following logic of activities execution:

if FIRST_RUN: SplashScreeen -> Logon -> MainScreenTabHost

if PUSH:

  1. Not Running: SplashScreeen -> Logon -> MainScreenTabHost
  2. Running: MainActivity receives a message

I can’t figure out how to achieve this. My source code for NotificationBar item:

Notification notif = new Notification(R.drawable.ic_launcher, "Text in status bar", 
System.currentTimeMillis());
Intent intent = new Intent(this, MainScreenTabHost.class);//HERE PROBLEM
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
notif.setLatestEventInfo(this, "Notification's title", "Notification's text", pIntent);
notif.flags |= Notification.FLAG_AUTO_CANCEL;
this.notificationManager.notify(1, notif);

This code always runs application MainScreenTabHost, but if application is not running it makes some init in Logon screen.

My question is: How can I check that application is running and if it’s not then create an Intent to run Splash screen and cycle for FIRST RUN? On the other hand, if application is running I just want to send an Intent (maybe a Broadcast) for some operations.

And one thing, my service is not always running because it is run by a broadcast intent from Push Notification.

  • 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-13T15:46:55+00:00Added an answer on June 13, 2026 at 3:46 pm

    Hm, i found next solution:

    // Check current activity
            ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    
            List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);
    
            ComponentName componentInfo = taskInfo.get(0).topActivity;
            if (componentInfo.getPackageName().equals(this.getPackageName())) {
                Intent broadCast = new Intent(MainScreenTabHost.BROADCAST_ACTION);
                broadCast.putExtras(arg1.getExtras());
                sendBroadcast(broadCast);
            } else {
    
                this.sendNotif(arg1);
            }
    

    So trick is: when fired onMessage method i check what activity currently on Top and if it’s part of mine – i just send broadcast to it. If NOT a show notification with SplashScreen intent.

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

Sidebar

Related Questions

In my android application, I have following requirement. Activity A --> Activity B(Go to
to send a message in my application in android i have used the following
I have an android application and while switching between two activities I want to
We have an Android application running on Android 2.2 on the Samsung Galaxy Tab
I have an insert entry logic into my android application which was responding perfectly
I have an android application using LocationManager get the cell network location and not
I have trouble to call following web service in android application. http://seba:pl,%5Dd77@www.bjadi.com/administrator/components/com_ivmstore/ivmwebservices/vmcategory.php I am
I am writing an android application to which I have granted the following privileges
I have the following java method, written for an android application. private String removeWifiFudge(String
I'm trying to accomplish the following (on my Android application): I want to have

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.