gpt4 book ai didi

android - 从广播接收器启动的 Activity 是否使用与应用程序相同的堆?

转载 作者:行者123 更新时间:2023-11-29 00:37:37 25 4
gpt4 key购买 nike

我在某处读到广播接收器在与应用程序不同的进程中运行,因此它有自己的堆。现在,如果在广播接收器中我从我的应用程序启动一个 Activity ,它会在应用程序的进程中运行还是仍在广播接收器的进程中?

这个问题的答案是否也适用于原生堆(pre-honeycomb API)?

我想知道,因为当我收到推送通知时必须启动一个占用大量内存的 Activity/屏幕,如果我在应用程序中处于其他占用大量内存的 Activity 的中间,它可能会导致内存不足错误.但如果它是一个单独的堆(更具体地说 - native 堆,因为内存消耗来自位图并且我正在为 API pre-honeycomb 开发)我不必担心它。

注意“在某处阅读”是指:Why so much memory?Nikolay Chorniy 的帖子

"There is a tricky workaround which I used to avoid OutOfMemoryError. I registered a receiver so that it ran on different process..."

最佳答案

I read somewhere that broadcast receiver runs in a separate process than the app

默认情况下,所有组件都在同一进程中运行。

Wondering because I have to start a memory expensive activity / screen when I receive a push notification

用户不一定会喜欢你在一个不知名的地方显示“内存消耗大的 Activity/屏幕”。

关于android - 从广播接收器启动的 Activity 是否使用与应用程序相同的堆?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11639857/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com