Persistent preferred activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 12:56 AM - last edited on 07-10-2023 04:54 AM by Lizzie
I have implemented a function in my Android app to set Brave browser as the default browser using the provided code snippet. However, when I click on a link, it still opens in Chrome instead of Brave. Could you please review the code snippet below and let me know if there's anything I am doing wrong?
private fun setBraveAsDefaultBrowser() {
val filter = IntentFilter(Intent.ACTION_VIEW)
filter.addCategory(Intent.CATEGORY_BROWSABLE)
filter.addDataScheme("http")
filter.addDataScheme("https")
val defaultBrowser: ComponentName = packageManager.getLaunchIntentForPackage("com.brave.browser")?.component ?: return
dpm.addPersistentPreferredActivity(
AdminReceiver.componentName,
filter,
defaultBrowser
)
}
I have used addPersistentPreferredActivity()
- Labels:
-
Apps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 02:14 AM
Are you talking about a "normal" app or an admin (like MDM) app where it's set as device admin app on the device itself?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 06:03 AM - edited 07-10-2023 06:09 AM
I am talking about an MDM app and Yes, the app is set as device admin app on the device itself. It uses DevicePolicyManager to enforce the restrictions. @Moombas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 06:07 AM
Yes, the app is set as device admin app on the device itself. It uses DevicePolicyManager to enforce the restrictions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 12:17 AM
@Moombas Waiting for your help in this matter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2023 12:44 AM
Sorry, i took a look into that last week but haven't found anything related which could help you.
Sorry. Maybe someone else a bit more confident with this topic may be able to help you.