Skip to main content

Work around for Broadcast receiver not working in Chinese mobiles

If you're having trouble with your Android app not responding to certain events in Mi, Oppo, Vivo or Letv devices it's not your fault.
This could include and is not limited to, service app not working properly, push notifications not working properly, application not opening up when intended. 
It is because of the extensive battery saver and the so-called saving the user from apps spamming their activity.

Here's the funniest part about it

We wrote to someone very senior at Xiaomi. He reverted that they manually whitelist a few apps, and the rest are by default disallowed from accessing the notifications folder. This was the response. "This usually happens because of whitelisting of apps that can access notifications folder. This is a feature to ensure the user is protected from spam and also helps to ensure RAM/battery usage optimization." We asked what the process was to get an app whitelisted, and did not get a response.  

This is coming from a post about GCM push notifications not working on Mi devices here.
https://stackoverflow.com/questions/40814126/gcm-push-notifications-for-android-devices-are-not-working-on-mi-and-letv-mobile/40932178#40932178

Funny because Chinese mobile manufacturers like Xiaomi, Oppo and Vivo first flood their phones with bloatware nobody asks for and even shove their useless articles and sponsored apps to users and here we see them talking about how they want to protect the user from spam and RAM and battery consumption.

The only solution is to get extensive permissions from the user which will be done manually and cannot be programmed for easiness.
What all permissions?
First, we need a permission to auto-start the application and then the permission to display pop-up window. 
App Settings > Permissions > Auto-Start
App Settings > Other Permissions > Display Pop-up

The most convenient workaround is to ask the user to manually permit these setting and open the settings page for the end-user.
This can be done by making a settings button that opens up the settings page.

settings = (Button)findViewById(R.id.settings);
settings.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                Uri uri = Uri.fromParts("package", getPackageName(), null);
                intent.setData(uri);
                startActivity(intent);
            }
        });

Useful links if you'd like to explore more.


Comments

Popular posts from this blog

How to delete Hot Apps folder on Oppo Realme

Bloat wares are the single worst enemy of anyone who just wants a simple experience with the mobile phones. Oppo goes to a next level in spamming stuff we don't need by their Hot Apps shortcut on Homescreen. And it is not always available in a new phone but comes after few hours sometimes days of usage. To disable this icon/folder/shortcut follow the steps below. 1. Open Settings. Swipe down the notification bar and open settings. 2. Open OPPO AppStore settings. Scroll all the way down and click OPPO AppStore. 3. Disable Homescreen folder for hot apps. That's it. You can also disable notification alert from App Store and Browser for even better Android experience as these apps spam a lot.

How to fix clothes flickering in Unreal Engine 5.

 This issue can be noticed some of the character clothes when using Paragon Characters in UE5. To fix the flickering issue, Use Self Collisions checkbox in collisions properties under the Static Mesh option of your character. Open the character model go to   Asset Details > Clothing Properties - Cloth Config - ChaosClothConfig - Collision Properties - Use Self Collisions > False

How to make download file button in react js

To create a download file button in React.js, follow these steps: Import the necessary dependencies: javascript Copy code import React from 'react' ; import { saveAs } from 'file-saver' ; Create a function that handles the download action: javascript Copy code const handleDownload = ( ) => { // Create a new Blob object with the desired content const fileContent = 'This is the content of the file you want to download.' ; const blob = new Blob ([fileContent], { type : 'text/plain;charset=utf-8' }); // Use the saveAs function from the file-saver library to initiate the download saveAs (blob, 'download.txt' ); }; Create a button component and attach the handleDownload function to the button's onClick event: javascript Copy code const DownloadButton = ( ) => { return ( < button onClick = {handleDownload} > Download File </ button > ); }; Use the DownloadButton component wherever ...