calling background service from BroadcastReceiver....
Posted
by Shalini Singh
on Stack Overflow
See other posts from Stack Overflow
or by Shalini Singh
Published on 2010-05-24T09:56:27Z
Indexed on
2010/05/24
10:01 UTC
Read the original article
Hit count: 337
android
Hi , i am trying to call a push notification background from BroadcastReceiver class.but my application is going to crash the code is given bellow
public class AlarmReceiver extends BroadcastReceiver { Context ctx;
static int count=1; @Override
public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub //Toast.makeText(context, "working"+count, Toast.LENGTH_LONG).show(); count++; Log.e("broadcast***","receiver"); Intent myIntent=new Intent(context,NotifyService.class); myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);
}
} * manifest entry:-
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
Error:
05-24 15:17:00.042: ERROR/AndroidRuntime(424): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.alarm/com.android.alarm.NotifyService}; have you declared this activity in your AndroidManifest.xml?
Please help me....
© Stack Overflow or respective owner