I don’t define something new in my code about it but I upgraded to latest version of Ionic and Capacitor Package and installed the package @capacitor-mlkit/barcode-scanning too.
Can someone help me to understand what is it and help me to fix it?
I added this line in the tsconfig.json file: "allowSyntheticDefaultImports": true,
Without it, I didn’t able to build or serve the app. I did see this in the content: Cannot GET /.
So by adding this line in the tsconfig file, I was able to fix this error but I don’t know it this could cause this “problem”.
It’s great that the location the error message references is empty I would double check all of your plugins to make sure they are all on versions that support Capacitor 6 / Android SDK 34.
The barcode scanning plugin has a release for v6. I searched the repo for registerReceiver and nothing was found so doubt that plugin is the cause.
In fact, I have this plugin folder with old packages:
I just use these 4 Cordova packages because I don’t see similar packages in Capacitor:
So: device-orientation to get compass feature and ios-disablesharetoedit (all is said in the name ^^). (The two other is generic or related to device-orientation).
All the other Cordova Plugin, I don’t use and need it. I just don’t know why there are still there.
Can I remove it manually or is there a command to run to do this?
Sorry, was just guessing on the cordova plugin remove command. I would think ionic cap sync android should remove unused plugin code. I could be wrong.
That “plugin” folder you are referencing is here?
android/app/src/main/assets/public/plugins
I have no idea but seems like you could manually delete them. I would run ionic cap sync android afterwards and see if they reappear.
No, I talked about the folder Plugins at the root of the ionic project. This is possible that this is an old Cordova way unremoved from this project.
I just try by removing this folder and then run the command “npx cap sync” or “ionic cap sync android”.
Now, I don’t have any result when I search “registerReceiver”.
When I run “ionic cap run android --prod --open”, everything works fine again.
But when I submit the build in Google Play Console, I get the same error/problem
So… don’t know. I have contacted Google to have more information.
I have the ability to ignore this problem message but I don’t think this is a good thing.
To let your informed, I just received a reply from Google but with a not very satisfactory return … they told me that:
This error typically indicates an issue with how your BroadcastReceiver is declared or registered within your Android application. It’s essential to ensure that it’s correctly defined in the Manifest file and registered or unregistered appropriately within your code.
Our team specializes in Play Console support. And we have limited resources in providing technical support for app development.
I will continue to investigate but this is very unclear for me
Ugh. Since they “specialize in Play Console support”, did you tell them that their error message in the Play Console is broken and doesn’t actually say what is causing the issue when it appears it should with the verbiage “in the following location”?
ME: The error message in the Play Console is broken and doesn’t actually say what is causing the issue when it appears it should with the verbiage “in the following location”. So, is it possible the have the missing information to help me to identify and fix the problem please?
GOOGLE: I understand that you’re looking for more information. Rest assured, I’ve already given you all the available information from my end to help resolve the issue.
They send me just 2 links to the documentation of the registerReceiver in Kotlint and Java.
So don’t really helpful unfortunately
Since everything works fine in my tests (simulators and real devices), do you think it is dangerous to ignore the issue (as suggested in the Google Play Console modal)?
After some tests and upgrades, I finally arrive to remove this “problem” in the Google Play Console.
Here is my latest changes:
Update the version of the package @awesome-cordova-plugins/core from 6.4.0 to 6.8.0.
Update the version of the package @awesome-cordova-plugins/device-orientation from 6.4.0 to 6.8.0.
Update the version of the package cordova-plugin-device-orientation from 2.0.1 to 3.0.0.
Remove the line android.defaults.buildfeatures.buildconfig=true from the file android/gradle.properties (as indicated in build warning of Android Studio).
Delete the folder android/capacitor-cordova-android-plugins and rebuild it using npx cap sync.
After that, I don’t have anymore the problem in Google Play Console
It sounds like you’re encountering issues with the BroadcastReceiver in your Play Store app. There are a few common reasons why a BroadcastReceiver might not behave as expected, especially with recent changes in Android’s background execution limits. Here are some troubleshooting steps and considerations:
Check Android Version
Starting with Android 8.0 (Oreo), there have been significant changes in how background broadcasts are handled. Make sure that your app’s logic is compliant with these changes. Explicit broadcasts (directed to your app) are usually fine, but implicit broadcasts (not directed to your app) might require more attention or alternative solutions like JobIntentService or WorkManager.
Manifest Declaration
Ensure that your BroadcastReceiver is correctly declared in the AndroidManifest.xml if you need it to work when the app is not running:
xml
Dynamic Registration
If your BroadcastReceiver is registered dynamically in code (using registerReceiver()), it will only be active while the app is running. Make sure you don’t rely solely on dynamic registration if you need to handle broadcasts while the app is in the background.
Permissions
Verify that you have the necessary permissions in your manifest, especially if your broadcast is related to system events like network changes, boot completion, etc.:
xml
5. Testing
- Test the BroadcastReceiver on different devices and Android versions to ensure consistent behavior. Emulator tests are also helpful but may not always replicate the exact conditions of a physical device.
6. Play Store Specifics
- If the issue is specifically related to behavior on the Play Store, consider whether there might be restrictions or changes related to app updates, permissions, or even recent changes in Play Store policies that could affect how your app’s receivers work.
If you can provide more details on the specific issue you're facing, such as error messages or the Android version you're targeting, it might be easier to pinpoint the problem.
Hope this helps, and feel free to share more information if you need further assistance!
This response should help guide the user through troubleshooting their BroadcastReceiver issue on the Play Store.