Are you starting activity that starts the service? Your logcat shows
that having activity thread. If it's not true, try sending pending
intent to start a service. That might be a workaround, but that should
get you moving.

On Apr 12, 2:14 pm, Te-Yuan Huang <huan...@gmail.com> wrote:
> Hi all,
>
> I am trying to start a service when the system boots up (no activity
> involved).
> I have a BroadcastReceiver listening to the ACTION_BOOT_COMPLETE
> intent, then start a service inside the onReceive function.
> From the log, I can see the BroadcastReceiver received the intent
> properly.
>
> However, when it tries to start a service through
> context.startService();
> The system complains cannot initiate the service:
>
> D/dalvikvm( 1393): newInstance failed: Lnet/startup/DispatchService;
> not accessible to Landroid/app/ActivityThread;
> D/AndroidRuntime( 1393): Shutting down VM
> W/dalvikvm( 1393): threadid=1: thread exiting with uncaught exception
> (group=0x4001d7e0)
> E/AndroidRuntime( 1393): FATAL EXCEPTION: main
> E/AndroidRuntime( 1393): java.lang.RuntimeException: Unable to
> instantiate service net.startup.DispatchService:
> java.lang.IllegalAccessException: access to class not allowed
> E/AndroidRuntime( 1393):        at
> android.app.ActivityThread.handleCreateService(ActivityThread.java:
> 2943)
>
> I have been googling all night and this morning, but still couldn't
> understand where went wrong.
> Is there any other permission I should set, so that the
> BroadcastReceiver can start the service?
> Note: the BroadcastReceiver and the Service is under the same
> package.
>
> Great thanks for any help.
>
> -Te-Yuan

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

Reply via email to