...
Code Block | ||
---|---|---|
| ||
public class MyRestartReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())
|| Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) {
final PushDialogConfig pushDialogConfig = new PushDialogConfig.Builder()
.build();
final BuzzAdPush buzzAdPush = new BuzzAdPush(
CustomNotificationWorker.class,
pushDialogConfig
);
buzzAdPush.registerWorkerIfNeeded(context);
}
}
}
|
Code Block | ||
---|---|---|
| ||
<manifest ... > ... <application ... > ... <receiver android:name=".MyRestartReceiver" android:exported="false"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> </intent-filter> </receiver> </application> </manifest> |
...