Skip to content Skip to sidebar Skip to footer

"launching" Another App With Services

I have 2 different apps in 2 different Application Projects in Eclipse. I will call them H and G. Until now, I have been able to launch H from G by using Intent intent = getPackage

Solution 1:

Try this:

privatevoidstartService(String aServiceName) {

    if (aServiceName.trim().length() > 0) {
        try {
            Contextctx= getApplicationContext();
            IntentiServiceIntent=this.ctx.getPackageManager().getLaunchIntentForPackage(aServiceName);
            ctx.startActivity(iServiceIntent);

            Thread.sleep(800);
        } catch (Exception e) {

        }           
    }
}

Solution 2:

The initial problem of it being unable to start the service was because I did not include the <service> to the AndroidManifest.xml which fixed that issue, and then the could not execute error was caused by a permissions issue. So all in all, all it took to fix my issues was including

<serviceandroid:name=".MyServiceHomework"android:exported="true"
/>

To the AndroidManifest.xml of my H (the service) project

Post a Comment for ""launching" Another App With Services"