From 59e21a62174dc364c9dab7b4367d920284cbe99b Mon Sep 17 00:00:00 2001 From: tatthangcntt Date: Fri, 2 Aug 2024 09:05:01 +0700 Subject: [PATCH 1/3] Upgrade target api 34 for android --- android/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 135606d3f..f4e658b89 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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 { From e2d10661e84e78de8d015153001657df7f5cf378 Mon Sep 17 00:00:00 2001 From: tatthangcntt Date: Mon, 12 Aug 2024 16:27:08 +0700 Subject: [PATCH 2/3] Fix issue 954: Crash app when answering PN call in Kill/bacground mode --- android/app/build.gradle | 3 +++ .../com/brekeke/phonedev/MainApplication.java | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index d2e80cc43..f82984f38 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -95,6 +95,9 @@ android { dependencies { implementation("com.facebook.react:react-android") implementation(jscFlavor) + // for fix issue: 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") diff --git a/android/app/src/main/java/com/brekeke/phonedev/MainApplication.java b/android/app/src/main/java/com/brekeke/phonedev/MainApplication.java index 4627a47ea..03c50bece 100644 --- a/android/app/src/main/java/com/brekeke/phonedev/MainApplication.java +++ b/android/app/src/main/java/com/brekeke/phonedev/MainApplication.java @@ -1,6 +1,12 @@ 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; @@ -8,6 +14,7 @@ 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 { @@ -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); + } + } } From 23c37058e01bafd01637669bdca5be42f88adc8e Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 7 Oct 2024 19:14:56 +0700 Subject: [PATCH 3/3] nam --- CHANGELOG.md | 1 + android/app/build.gradle | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bad4853db..ba6725262 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 " in call history (issue 862) diff --git a/android/app/build.gradle b/android/app/build.gradle index 584225eb3..6d314b08c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -95,13 +95,13 @@ android { dependencies { implementation("com.facebook.react:react-android") implementation(jscFlavor) - // for fix issue: 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' + // 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")