Reputation:
I want call another activity from BroadcastReceiver, but this code below is not calling the activity. please help me out to find appropriate answer.
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent newIntent = new Intent("com.example.alaram.MESG");
context.startService(newIntent);
}
}
Upvotes: 2
Views: 174
Reputation: 3939
The call to startService() starts a Service, not an Activity... as the name suggests.
Try:
Intent intent = new Intent(context, YourActivity.class);
context.startActivity(intent);
Upvotes: 1