Skip to content

Commit 1e4937f

Browse files
authored
Merge pull request #72 from DeployGate/fix/unspecified_receiver_registration
Specify export flag for Context-based receiver
2 parents bd04896 + 0d90374 commit 1e4937f

File tree

8 files changed

+28
-20
lines changed

8 files changed

+28
-20
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ version: 2.1
33
executors:
44
android:
55
docker:
6-
- image: cimg/android:2022.03
6+
- image: cimg/android:2023.07
77
working_directory: ~/deploygate-android-sdk
88
environment:
9-
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError" -Dorg.gradle.daemon=false'
9+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" -Dorg.gradle.daemon=false'
1010

1111
commands:
1212
restore_gradle_cache:

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v3
1616
- uses: actions/setup-java@v3
1717
with:
18-
java-version: '8.x'
18+
java-version: '17.x'
1919
java-package: jdk
2020
distribution: 'temurin'
2121
cache: 'gradle'

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: actions/checkout@v3
2121
- uses: actions/setup-java@v3
2222
with:
23-
java-version: '8.x'
23+
java-version: '17.x'
2424
java-package: jdk
2525
distribution: 'temurin'
2626
cache: 'gradle'
@@ -57,7 +57,7 @@ jobs:
5757
- uses: actions/checkout@v3
5858
- uses: actions/setup-java@v3
5959
with:
60-
java-version: '8.x'
60+
java-version: '17.x'
6161
java-package: jdk
6262
distribution: 'temurin'
6363
cache: 'gradle'

build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ buildscript {
77
repositories {
88
mavenCentral()
99
google()
10+
gradlePluginPortal()
1011
}
1112
dependencies {
12-
classpath 'com.android.tools.build:gradle:4.2.2'
13-
classpath 'com.akaita.android:easylauncher:1.3.1'
13+
classpath 'com.android.tools.build:gradle:7.4.2'
14+
classpath 'com.project.starter:easylauncher:5.0.1'
1415
}
1516
}
1617

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

sample/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
2-
apply plugin: 'com.akaita.android.easylauncher'
2+
apply plugin: 'com.starter.easylauncher'
33

44
android {
5-
compileSdkVersion = 32
5+
compileSdkVersion 33
66

77
defaultConfig {
88
applicationId "com.deploygate.sample"
99
minSdkVersion 14
10-
targetSdkVersion 32
10+
targetSdkVersion 33
1111
}
1212

1313
buildTypes {
@@ -56,7 +56,7 @@ android {
5656
}
5757

5858
easylauncher {
59-
defaultFlavorNaming = true
59+
defaultFlavorNaming true
6060

6161
productFlavors {
6262
devreal {

sdk.build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ apply plugin: 'maven-publish'
44
version = rootProject.ext.releaseVersion
55

66
android {
7-
compileSdkVersion 29
7+
compileSdkVersion 33
88

99
defaultConfig {
1010
minSdkVersion 14
11-
targetSdkVersion 29
11+
targetSdkVersion 33
1212
versionCode 1
1313
versionName project.version
1414
manifestPlaceholders = [sdkVersion:"4"]
@@ -40,11 +40,11 @@ android {
4040
}
4141

4242
dependencies {
43-
testImplementation 'androidx.test:runner:1.2.0'
44-
testImplementation 'androidx.test.ext:junit:1.1.1'
45-
testImplementation 'org.robolectric:robolectric:4.3.1'
43+
testImplementation 'androidx.test:runner:1.5.2'
44+
testImplementation 'androidx.test.ext:junit:1.1.5'
45+
testImplementation 'org.robolectric:robolectric:4.10.3'
4646

47-
testImplementation 'androidx.test:rules:1.2.0'
47+
testImplementation 'androidx.test:rules:1.5.0'
4848
testImplementation 'com.google.truth:truth:1.0'
4949
}
5050

sdk/src/main/java/com/deploygate/sdk/DeployGate.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.content.Intent;
88
import android.content.IntentFilter;
99
import android.content.ServiceConnection;
10+
import android.os.Build;
1011
import android.os.Bundle;
1112
import android.os.Handler;
1213
import android.os.IBinder;
@@ -259,7 +260,7 @@ private boolean initService(boolean isBoot) {
259260

260261
private void prepareBroadcastReceiver() {
261262
IntentFilter filter = new IntentFilter(ACTION_DEPLOYGATE_STARTED);
262-
mApplicationContext.registerReceiver(new BroadcastReceiver() {
263+
BroadcastReceiver receiver = new BroadcastReceiver() {
263264
@Override
264265
public void onReceive(
265266
Context context,
@@ -272,7 +273,13 @@ public void onReceive(
272273
bindToService(false);
273274
}
274275
}
275-
}, filter);
276+
};
277+
278+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
279+
mApplicationContext.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED);
280+
} else {
281+
mApplicationContext.registerReceiver(receiver, filter);
282+
}
276283
}
277284

278285
private void bindToService(final boolean isBoot) {

0 commit comments

Comments
 (0)