Skip to content

Commit

Permalink
Upgrade android target sdk 34 to update with Google policy
Browse files Browse the repository at this point in the history
  • Loading branch information
tatthangcntt authored Oct 7, 2024
1 parent 69baf02 commit 87565ea
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#### 2.15.1

- Upgrade android target sdk 34 to update with Google policy
- Implement push notification timestamp
- Fix it should not reload custom page after reconnect internet/server (issue 793)
- Fix it should show "answered by <ext>" in call history (issue 862)
Expand Down
5 changes: 4 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ android {
dependencies {
implementation("com.facebook.react:react-android")
implementation(jscFlavor)
// java.lang.SecurityException: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED
// https://medium.com/@siddhantshelake/fixing-broadcastreceiver-crashes-and-metro-server-issues-in-android-14-3b7d05939a43
implementation("org.jetbrains:annotations:16.0.2")

// react-native-notfication
implementation platform("com.google.firebase:firebase-bom:32.1.0")
implementation "com.google.firebase:firebase-messaging"
implementation("com.google.firebase:firebase-messaging")

// custom lib to display avatar in PN screen
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package com.brekeke.phonedev;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.soloader.SoLoader;
import java.util.List;
import org.jetbrains.annotations.Nullable;

public class MainApplication extends Application implements ReactApplication {

Expand Down Expand Up @@ -51,4 +58,15 @@ public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}

@SuppressLint("WrongConstant")
@Override
public Intent registerReceiver(@Nullable BroadcastReceiver receiver, IntentFilter filter) {
// https://medium.com/@siddhantshelake/fixing-broadcastreceiver-crashes-and-metro-server-issues-in-android-14-3b7d05939a43
if (Build.VERSION.SDK_INT >= 34 && getApplicationInfo().targetSdkVersion >= 34) {
return super.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED);
} else {
return super.registerReceiver(receiver, filter);
}
}
}
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
buildscript {
ext {
buildToolsVersion = "33.0.0"
buildToolsVersion = "34.0.0"
minSdkVersion = 27
compileSdkVersion = 33
compileSdkVersion = 34
// https://developer.android.com/google/play/requirements/target-sdk
targetSdkVersion = 33
targetSdkVersion = 34
ndkVersion = "23.1.7779620"
}
repositories {
Expand Down

0 comments on commit 87565ea

Please sign in to comment.