Lucifer
Lucifer

Reputation: 29632

How to Share Variables Value Between two Running Android Applications

I have a first Android application, running in background (as service). A second application is running at the same time, which has a GUI. Now I want some information to be passed from my first application to my second application.

So how can I achieve this?

Upvotes: 1

Views: 640

Answers (3)

paulsm4
paulsm4

Reputation: 121649

Yet another possibility is to use shared memory (i.e. Android "ashmem"):

Upvotes: 0

Venky
Venky

Reputation: 11107

It depends on the Data you are sharing either Primitive type or Persistent Data or Non-Persistent Data.

If Primitive data - use Intent.putExtras().

Non-Persistent Objects -

  1. Singleton class

  2. A public static field/method

  3. A HashMap of WeakReferences to Objects

Persistent Objects :

  1. Application Preferences

  2. Files

  3. ContentProviders

4.SQLite DB

Check this Developer guide for Further reference.

Upvotes: 1

jeet
jeet

Reputation: 29199

use Content Provider for the same. See http://www.devx.com/wireless/Article/41133/1954

Upvotes: 2

Related Questions