Found the answer -

Since there were no intent filters specified in the manifest for this
Service the default for android:exported was false.  When I set
android:exported="true" the other application was able to start the
Service.

http://developer.android.com/intl/zh-CN/guide/topics/manifest/service-element.html#exported

On Dec 23, 2:35 pm, jotobjects <[email protected]> wrote:
> Trying to start a Service in another application with this code:
>
> startService((new Intent()).setComponent(new ComponentName(
>
> "com.foobar.memtest","com.foobar.memtest.RunningService")));
>
> and get this exception:
>
> java.lang.SecurityException: Not allowed to start service Intent
> { comp={com
> .foobar.memtest/com.foobar.memtest.RunningService} } without
> permission private
> to package
>
> The manifest for com.foobar.memtest does not have any permissions set
> for the Service or the Application.  The manifest docs for <service>
> android:permission say -
>
> "If this attribute is not set, the permission set by the <application>
> element's permission attribute applies to the service. If neither
> attribute is set, the service is not protected by a permission."
>
> So if the service is not protected by a permission why does the
> exception say a permission is required?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to