October 2018
Intermediate to advanced
464 pages
15h 17m
English
If you followed the previous recipe, then you already have a Broadcast Receiver. You don't need a separate BroadcastReceiver for each action, just check for each action as needed. Here's an example if we need to handle another action:
@Overridepublic void onReceive(Context context, Intent intent) { if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) { Toast.makeText(context, "BOOT_COMPLETED", Toast.LENGTH_SHORT).show(); } else if (intent.getAction().equals("<another_action>")) { //handle another action }}