If you’ve ever faced issues with notifications not being delivered in your app due to restrictive OEM settings, you’re not alone. The AutoStarter library is here to help by simplifying the process of prompting users to allow autostart permissions for your app. This handy library helps bring up the autostart permission manager of a phone, making it easier for users to add your app to the autostart list. Let’s dive into how to use this valuable library effectively.
Why Use the AutoStarter Library?
Many Android devices with custom user interfaces, like those from Xiaomi and Letv, struggle to receive notifications correctly. This is because OEMs often blacklist apps that aren’t recognized as essential. AutoStarter alleviates this issue by letting users grant autostart permissions to your app, allowing it to run in the background and receive notifications seamlessly. Unfortunately, since different OEMs have varied implementations, there isn’t a universal solution. That’s where the AutoStarter library shines.
Getting Started with AutoStarter
To begin using the AutoStarter library in your Android project, follow these straightforward steps:
1. Add the Dependency
Choose one of the following methods to add AutoStarter to your project:
- Using Gradle: Add this line to your module’s
build.gradlefile:
implementation 'com.github.judemanutd:autostarter:1.1.0'
pom.xml file:<dependency>
<groupId>com.github.judemanutd</groupId>
<artifactId>autostarter</artifactId>
<version>1.1.0</version>
<type>pom</type>
</dependency>
2. Calling the Permission Manager
Once the library is integrated, you can prompt the autostart permission manager using the following code snippet:
AutoStartPermissionHelper.getInstance().getAutoStartPermission(context)
This function returns a boolean indicating success or failure. You can control its behavior by passing true or false for the second and third parameters, affecting whether it attempts to open the activity or checks its existence.
3. Checking Compatibility
To verify if your device supports the library, you can use:
AutoStartPermissionHelper.getInstance().isAutoStartPermissionAvailable(context)
This method can be configured to check strictly for supported screens or simply for the existence of the permission.
Understanding the Code: An Analogy
Think of the AutoStarter library like a doorman at a club (your app). In this scenario, the autostart permission works like VIP club access. Some entities (OEMs) have strict entrance rules, only allowing recognized guests (whitelisted apps). Other unrecognized guests (your app) need to convince the doorman (the permission manager) to let them in. With AutoStarter, you’re essentially giving your users the means to convince the doorman to grant entry, ensuring they won’t miss out on notifications!
Troubleshooting Common Issues
If you encounter issues while using the AutoStarter library, consider the following troubleshooting steps:
- Ensure that you’ve correctly added the library in your project.
- Check if your device’s OEM is supported by the library.
- Verify that you call the permission manager function at the right time in your app’s lifecycle.
- For specific issues related to your device, consult the OEM’s documentation or community forums.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
By integrating the AutoStarter library, you help your users navigate the sometimes complex permissions landscape of Android, ensuring that your app can perform its best even on restrictive devices. At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

