Failed to start service Intent {flg = 0x4 cmp = com.UserLogin / .BgService (has additional functions)}: not found

I am trying to start a service using Alarmmanager with pendingIntent. I am stuck with a Unable to start service Intent { flg=0x4 cmp=com.UserLogin/.BgService (has extras) }: not found

 bug that I have searched on google and searched on stackoverflow, saw some questions about this error, but these solutions don't work for me. / ... , enter the link here , please check it once.

Service class:

public class BgService extends Service {

    public IBinder onBind(Intent intent) {
        // TODO Auto-generated method stub
        return null;
    public void onCreate() {
        // TODO Auto-generated method stub
    public void onStart(Intent intent, int startId) {
        // TODO Auto-generated method stub
        super.onStart(intent, startId);

    public int onStartCommand(Intent intent, int flags, int startId) {
        // TODO Auto-generated method stub
       return super.onStartCommand(intent, flags, 10);



    <manifest xmlns:android=""
    android:versionName="1.0" >
    <service android:name="com.UserLogin.BgService" />
    <uses-library android:name="" />
    <uses-library android:name="" />

        android:name="com.UserLogin.MyActivity" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CALL_PHONE" /></manifest>


java class

 Intent myIn1tent = new Intent(UserLogin.this, BgService.class);
 pendingIntent = PendingIntent.getService(UserLogin.this, 0, myIn1tent , 0);
 AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
 long firstTime = SystemClock.elapsedRealtime();
 alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, firstTime, 30 * 1000, pendingIntent);


Logcat error:

03-29 14:30:47.337: W/ActivityManager(58): Unable to start service Intent { flg=0x4 cmp=com.UserLogin/.BgService (has extras) }: not found



source to share

1 answer

Your service declaration in the manifest must be nested within an application tag like this.

<service android:name="" />


and yes ... how can your activity be outside your app tag ..: |



All Articles