Skip to content

Commit

Permalink
fix(sample): 大于API 33,广播插件case,运行崩溃
Browse files Browse the repository at this point in the history
大于API 33,广播插件测试case,运行崩溃
  • Loading branch information
AntonioShare authored and shifujun committed Dec 24, 2024
1 parent f345894 commit d577c95
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
Expand Down Expand Up @@ -69,7 +70,12 @@ public void onClick(View v) {
}
});

registerReceiver(new DynamicBroadcastReceiver(), new IntentFilter(INTENT_ACTION));
DynamicBroadcastReceiver dynamicBroadcastReceiver = new DynamicBroadcastReceiver();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) {
registerReceiver(dynamicBroadcastReceiver, new IntentFilter(INTENT_ACTION), Context.RECEIVER_EXPORTED);
} else {
registerReceiver(dynamicBroadcastReceiver, new IntentFilter(INTENT_ACTION));
}
}


Expand Down

0 comments on commit d577c95

Please sign in to comment.