שימוש מופרז ברשת סלולרית ברקע
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כשמפעילים אפליקציה שמתחברת לרשת הסלולרית ברקע,
האפליקציה מעירה את המעבד ומפעילה את הרדיו. ביצוע הפעולה הזו שוב ושוב עלול לרוקן את הסוללה של המכשיר. אפליקציה נחשבת כפועלת ברקע אם היא במצב PROCESS_STATE_BACKGROUND
או PROCESS_STATE_CACHED
.
בדף הזה מוסבר איך לגלות למה האפליקציה משתמשת ברשת הסלולרית באופן מוגזם בזמן שהיא פועלת ברקע, ומה אפשר לעשות בנידון.
זיהוי הבעיה
יכול להיות שלא תמיד תדעו שהאפליקציה שלכם עושה שימוש מוגזם ברשת כשהיא פועלת ברקע. אם כבר פרסמתם את האפליקציה, תוכלו להיעזר בנתוני התפקוד של Android כדי לזהות את הבעיה ולתקן אותה.
תפקוד האפליקציה
הנתונים של תפקוד האפליקציה יכולים לעזור לכם לשפר את הביצועים של האפליקציה. מערכת Play Console תשלח לכם התראות אם האפליקציה משתמשת ברשת הסלולרית באופן מוגזם ברקע.
ב-Android vitals, שימוש ברשת ברקע נחשב מוגזם כשהאפליקציה שולחת ומקבלת סכום כולל של 50MB ליום בזמן שהיא פועלת ברקע. ב-Play Console אפשר לבדוק את אחוז הסשנים של הסוללה שבהם נצפתה ההתנהגות הזו.
ההגדרה של battery session תלויה בגרסת הפלטפורמה.
- ב-Android 10, מחזור סוללה הוא צבירה של כל דוחות הסוללה שהתקבלו במהלך תקופה של 24 שעות. דוח סוללה מתייחס למרווח הזמן בין שתי טעינות של הסוללה, או מטעינה מתחת ל-20% לטעינה מעל 80%, או מטעינה בכל רמה לטעינה של 100%.
- ב-Android 11, מחזור טעינת סוללה הוא פרק זמן קבוע של 24 שעות.
מידע על האופן שבו Google Play אוסף נתונים של תפקוד האפליקציה ב-Android מופיע במסמכי התיעוד של Play Console.
בדיקת התנהגות שקשורה לשימוש ברשת סלולרית
כלים כמו Battery Historian יכולים לעזור לכם לקבל תובנות נוספות לגבי השימוש של האפליקציה ברשת הסלולרית. Battery Historian מספק תצוגה חזותית של השימוש ברדיו במכשיר הנייד על בסיס כל אפליקציה, שיכולה לעזור לכם לקבל תמונה ברורה יותר של מה שקורה באפליקציה. מידע נוסף על Battery Historian זמין במאמר ניתוח השימוש באנרגיה באמצעות Battery Historian.
כשבודקים את התנהגות השימוש ברשת הסלולרית של האפליקציה, חשוב לשים לב במיוחד לשורה Mobile network use (שימוש ברשת הסלולרית).
מידע על המכניקה של השימוש ב-Battery Historian זמין במאמר Batterystats and Battery Historian Walkthrough.
איך מצמצמים את השימוש ברשת הסלולרית
אתם יכולים להעביר את השימוש של האפליקציה ברשת הסלולרית לחזית, להציג למשתמש התראה על כך שההורדה מתבצעת ולספק לו אמצעי בקרה להשהיה או להפסקת ההורדה. כדי לעשות זאת, מתקשרים אל
DownloadManager
ומגדירים את
setNotificationVisibility(int)
לערך המתאים.
מומלץ עבורך
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Excessive Mobile Network Usage in Background\n\nWhen an app connects to the mobile network in the background,\nthe app wakes up the CPU and turns on the radio. Doing so\nrepeatedly can run down a device's battery. An app is considered to be running\nin the background if it is in the `PROCESS_STATE_BACKGROUND` or\n`PROCESS_STATE_CACHED` state.\n\nThis page explains how to determine why your app is excessively using the\nmobile network while running in the background, and what to do about it.\n\nDetect the problem\n------------------\n\nYou may not always know that your app is making inordinate use of the\nnetwork while running in the background. If you have already published\nyour app, Android vitals can make you aware of the problem so that you can fix\nit.\n\n### Android vitals\n\nAndroid vitals can help improve your app's performance by alerting you via the\n[Play Console](https://play.google.com/console/) when your app is\nusing the mobile network excessively in the background.\n\nAndroid vitals considers background network usage excessive when an app is\nsending and receiving a combined total of 50 MB per day while running in the\nbackground. In Play Console you can check percentage of *battery sessions*\nthat exhibit this behavior.\n\nThe definition of *battery session* depends on the platform version.\n\n- In Android 10, a battery session is the aggregation of all battery reports received within a given 24-hour period. A *battery report* refers to the interval between two battery charges either from below 20% to above 80% or from any charge level to 100%.\n- In Android 11, a battery session is a fixed 24-hour period.\n\nFor information on how Google Play collects Android vitals data, see the [Play\nConsole](https://support.google.com/googleplay/android-developer/answer/7385505)\ndocumentation.\n\nInvestigate mobile-network-usage behavior\n-----------------------------------------\n\n| **Warning:** Battery Historian is no longer actively maintained; if possible, consider using [system tracing](/topic/performance/tracing), the [Macrobenchmark](/topic/performance/benchmarking/macrobenchmark-overview) power metric, or the [Power Profiler](/studio/profile/power-profiler) to get insights into battery performance.\n\nTools such as Battery Historian can help you gain more insight into your\napp's mobile-network usage. Battery Historian provides a visualization of\nmobile-radio use on a per-app basis, which can help you gain a clearer\npicture of what's happening with your app. For more information about Battery\nHistorian, see\n[Analyzing Power Use with Battery Historian](/topic/performance/power/battery-historian#asd).\nIn investigating your app's mobile-network-usage behavior, you should take\nparticular note of the *Mobile network use* line.\n\nFor information about the mechanics of using Battery Historian, see\n[Batterystats and Battery Historian Walkthrough](/topic/performance/power/setup-battery-historian).\n\nReduce mobile network usage\n---------------------------\n\nYou can move your app's mobile-network usage to the foreground, alerting\nthe user to the fact that a download is in progress, and providing them\nwith controls to pause or stop the download. To do so, call\n[`DownloadManager`](/reference/android/app/DownloadManager), and set\n[`setNotificationVisibility(int)`](/reference/android/app/DownloadManager.Request#setNotificationVisibility(int))\nas appropriate.\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Excessive Wi-Fi Scanning in the Background](/topic/performance/vitals/bg-wifi)"]]