@@ -0,0 +1,1857 @@
+package io.particle.android.sdk.devicesetup;%0A%0A%0Aimport android.content.BroadcastReceiver;%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.content.IntentFilter;%0A%0A%0Apublic class SimpleReceiver extends BroadcastReceiver %7B%0A%0A    public interface LambdafiableBroadcastReceiver %7B%0A        void onReceive(Context context, Intent intent);%0A    %7D%0A%0A%0A    public static SimpleReceiver newReceiver(Context ctx, IntentFilter intentFilter,%0A                                             LambdafiableBroadcastReceiver receiver) %7B%0A        return new SimpleReceiver(ctx, intentFilter, receiver);%0A    %7D%0A%0A%0A    public static SimpleReceiver newRegisteredReceiver(Context ctx, IntentFilter intentFilter,%0A                                                       LambdafiableBroadcastReceiver receiver) %7B%0A        SimpleReceiver sr = new SimpleReceiver(ctx, intentFilter, receiver);%0A        sr.register();%0A        return sr;%0A    %7D%0A%0A%0A    private final Context appContext;%0A    private final IntentFilter intentFilter;%0A    private final LambdafiableBroadcastReceiver receiver;%0A%0A    private boolean registered = false;%0A%0A    private SimpleReceiver(Context ctx, IntentFilter intentFilter,%0A                           LambdafiableBroadcastReceiver receiver) %7B%0A        this.appContext = ctx.getApplicationContext();%0A        this.intentFilter = intentFilter;%0A        this.receiver = receiver;%0A    %7D%0A%0A    @Override%0A    public void onReceive(Context context, Intent intent) %7B%0A        receiver.onReceive(context, intent);%0A    %7D%0A%0A    public void register() %7B%0A        if (registered) %7B%0A            return;%0A        %7D%0A        appContext.registerReceiver(this, intentFilter);%0A        registered = true;%0A    %7D%0A%0A    public void unregister() %7B%0A        if (!registered) %7B%0A            return;%0A        %7D%0A        appContext.unregisterReceiver(this);%0A        registered = false;%0A    %7D%0A%0A%7D%0A

Create util class to make broadcast receivers less awkward