Hi,

I already searched stackoverflow, this forum and google itself.
Followed all instructions, but i still cannot get my service to be
started at the BOOT_COMPLETED.

The sample i'm using came from 
http://marakana.com/forums/android/examples/108.html

This is the service:

package totalcross.appqiri;
...
public class TCService extends Service
{
   public IBinder onBind(Intent intent)
   {
      return null;
   }

   public void onStart(Intent intent, int startId)
   {
      super.onStart(intent, startId);
   }

   public void onCreate()
   {
         super.onCreate();
   }

   public int onStartCommand(Intent intent, int flags, int startId)
   {
      return START_STICKY;
   }

   public void onDestroy()
   {
      super.onDestroy();
   }
}

This is part of the manifest.xml:

    <application android:icon="@drawable/icon"
android:label="TotalCross Virtual Machine"
         android:theme="@android:style/Theme.Black.NoTitleBar" >
        <activity android:name=".Loader" android:label="Loading
application..."
     android:configChanges="keyboardHidden|orientation|screenLayout|
fontScale|keyboard"
        android:windowSoftInputMode="adjustResize"
        />
        <activity android:name=".WebViewer" />
        <activity android:name=".CameraViewer" />
        <activity android:name=".MapViewer" />
        <uses-library android:name="com.google.android.maps"
android:required="false" />

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

    </application>

This is the startup intent that receives the BOOT_COMPLETED:

public class StartupIntentReceiver extends BroadcastReceiver
{
   public void onReceive(Context context, Intent intent)
   {
      try
      {
               AndroidUtils.debug("*** 1");
               Class cc =
Class.forName("totalcross.appqiri.TCService");
               AndroidUtils.debug("*** 2");
               Object o = cc.newInstance();
               AndroidUtils.debug("*** 3: "+o);
               AndroidUtils.debug("*** 4: "+context.getPackageName());
               Intent i = new Intent(context, cc);
               AndroidUtils.debug("*** 5: "+i);
               Object ret = context.startService(i);
               AndroidUtils.debug("*** 6: "+ret);
      }
      catch (Throwable e)
      {
         AndroidUtils.handleException(e, false);
      }
   }
}

And, finally, this is the output:

ActivityManager: Start proc totalcross.appqiri for broadcast
totalcross.appqiri/.StartupIntentReceiver:
TotalCross: *** 3: totalcross.appqiri.TCService@404edb18
TotalCross: *** 4: totalcross.appqiri
TotalCross: *** 5: Intent { cmp=totalcross.appqiri/.TCService }
ActivityManager: Unable to start service Intent
{ cmp=totalcross.appqiri/.TCService }: not found

As you can see:

1. The <service> is inside <application> in the xml
2. The context' package is the same of the service (line ***3 and
***4)
3. I can load the service using introspection

However, the service cannot be found.

any help is greatly appreciated.

thanks

     guich

-- 
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