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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:58:04+00:00 2026-06-15T21:58:04+00:00

my app need to launch a app and send my data to it. i

  • 0

my app need to launch a app and send my data to it.
i used this to launch the app(both new and from background):

Intent wakeIntent = new Intent(Intent.ACTION_MAIN);

wakeIntent.putExtra("type", type);

wakeIntent.putExtra("scheduleId", id);
wakeIntent.addCategory(Intent.CATEGORY_LAUNCHER);

//welcome is launcher of the target app                                                 

wakeIntent.setClass(getApplicationContext(), WelcomeActivity.class);
wakeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(wakeIntent);

the WelcomeActivity can receive the data “type”,”id” in intent when i launch the app as new ,
but if the app has already launched and switched background, it occurs that the wakened background app can not receive the data. how to

best regards to any

  • 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-15T21:58:05+00:00Added an answer on June 15, 2026 at 9:58 pm

    You can do this using Shared Preferences by storing "type","id" in Shared Preferences before launching WelcomeActivity from your Current Activity as:

    For example i’m starting WelcomeActivity on button click from FirstActivity :

    public class FirstActivity extends Activity {
    SharedPreferences myPrefs;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
           button.setOnClickListener(new OnClickListener() {
           void onClick() {
             //Create 
    
            myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
            SharedPreferences.Editor prefsEditor = myPrefs.edit();
            prefsEditor.putString("type", type);
            prefsEditor.putString("scheduleId", scheduleId);
            prefsEditor.commit();
    
           //start WelcomeActivity here
        Intent wakeIntent = new Intent(Intent.ACTION_MAIN);
    
        wakeIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    
        //welcome is launcher of the target app                                                 
    
        wakeIntent.setClass(getApplicationContext(), WelcomeActivity.class);
        wakeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(wakeIntent);
    
            }
        });
        }
    }
    

    And in WelcomeActivity Activity read this SharedPreferences in both onCreate and onResume as:

    public class FirstActivity extends Activity {
    SharedPreferences myPrefs;
    
    public static boolean status=false;
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
    
            // this will read when first time start
            myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
            String strtype = myPrefs.getString("type", "nothing");
            String strscheduleId = myPrefs.getString("scheduleId", "0");
            status=true;
    
        }
    
        @Override
        protected void onResume() {
            super.onResume();
            // The activity has become visible (it is now "resumed").
           if(status!=true){
                     // this will read when first time start
            myPrefs = this.getSharedPreferences("myPrefs", MODE_WORLD_READABLE);
            String strtype = myPrefs.getString("type", "nothing");
            String strscheduleId = myPrefs.getString("scheduleId", "0");
           }
        }
    
        @Override
        protected void onPause() {
            super.onPause();
         // Another activity is taking focus (this activity is about to be "paused").
    
            // reset counter here
            status=false;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to launch 'TextMate' from an App, and I used the following code.
I need to launch call task in my wp7 app. once i launch this
I want to launch an app on OSX from a script. I need to
I am working on new app development in android. I need to launch an
i want to launch an intent from android website what code do i need
I have a very strange requirement... I need to launch my app from let's
I need to send some left-over data to server when my app starts, so
I have an app I need to update with new data for the DB.
I need to launch an app I've made just after login, before anything else
My App need to save some data (around 100 double fields that is stored

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.