senior
senior

Reputation: 425

android - sending intents between two different services in two different applications

i am trying to pass data (string\int) between two service in two different application service A in app1 and service B in app2. say i want to pass from application 1 -> 2 , so i defined a custom receiver in the manifest in app 2 with an intent filter with an action string

    <receiver android:name=".blaReceiver">
        <intent-filter>
        <action android:name="com.bla.blabla.RANDOM_ACTION" />
        </intent-filter>
    </receiver>

but how do i send the intent from app 1 ? there are no activities only services, i thought of startService from app1 but there is no where i can define it to sent the intent to app2

Thanks.

Upvotes: 0

Views: 613

Answers (2)

erni
erni

Reputation: 83

You can use sendBroadcast(intent); in your service. It works for sure.

Upvotes: 0

SohailAziz
SohailAziz

Reputation: 8034

Use broadcast receivers. Send broadcast [with unique action name]from app A and register a broadcast receiver in app B. [broadcast will be sent system-wide]. Receive broadcast in you app B and verify it by action name.

Upvotes: 1

Related Questions