ActivityManager: Unable to start service Intent

3k views Asked by At

I have an Android application in which I have implemented a service which has been declared as "exported" in Android Manifest. Lot of different applications are installed on this device which are trying to start this exported service. All of them are using this code to start the exported service :

    MY_ACTION = "com.phantom.foobar.action.xyz"
    PACKAGE_NAME = "com.phantom.foobar"
    CLASS_NAME = "com.phantom.foobar.IpcService"  


    public static void startSaveUrlAction(Context context, String foo, String bar) {
        Intent intent = new Intent(MY_ACTION);
        intent.setClassName(PACKAGE_NAME, CLASS_NAME);
        intent.putExtra(FOO, foo);
        intent.putExtra(BAR, bar);
        context.startService(intent);
    }

Service description inside application tag in Manifest file:

<service
    android:name=".IpcService"
    android:exported="true" />

Now the problem is some applications are able to start it and some are not. Here's logcat information for the applications which are not able to start that service :

01-02 16:04:05.574  1385  2698 W ActivityManager: Unable to start service Intent { cmp=another.music.player/com.phantom.foobar.IpcService } U=0: not found
01-02 16:04:05.575  1385  2699 W ActivityManager: Unable to start service Intent { cmp=another.music.player/com.phantom.foobar.IpcService } U=0: not found

If I'm not wrong, { cmp=another.music.player/com.phantom.foobar.IpcService } this is a component name comprised of { cmp = package_name/class_name }. Even though I have specified PACKAGE_NAME as com.phantom.foobar but it's trying to start the wrong intent. In this case, another.music.player is the package name of the application which is trying to start an exported service.

This only happens with some of the applications. I want to know why this is happening. Is there any attribute or something(some kind of attribute which can be set in Android Manifest) which can prevent an application to start an intent outside the package ?

Abstracted Details :

I'm using Xposed Framework which allows me to hook method of other applications. I have hooked a method from Android API. Now whenever that method is being called in other applications, I extract some information from that application and using its context, I start exported IntentService of com.phantom.foobar, hence passing information to my application using above given function.

0

There are 0 answers