Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPatrick Munemo
14,892 PointsIntents and Broadcast receivers
Now build it! Store it in the new Notification
public class DistressCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Add your code here!
Notification.Builder notif = new Notification.Builder(context);
notif.setSmallIcon(R.drawable.ic_distress);
notif.setContentTitle("Incoming Distress Signal");
notif.setContentText("A distress call has been received from somewhere in space and time.");
Notification.Builder.build();
}
}
1 Answer
Steve Hunter
57,712 PointsHi Patrick,
You call .build()
on your instance, notif
and store it in a Notification
variable like this:
Notification notification = notif.build();
I hope that helps,
Steve.
Patrick Munemo
14,892 PointsPatrick Munemo
14,892 PointsThanks Steve, it worked