2016-09-29 122 views
0

我在我的項目中根據latest tutorial from google實現了推送通知。Android GCM MeasurementBrokerService吃了太多內存

我的應用程序有2個後臺服務正在運行。

當我看着RAM內存,我的應用程序佔用,我看到(例如):
- 總內存使用117 MB
- 內存的應用程序使用13 MB
- 谷歌播放服務( com.google.android.gms) - 104 Mb(!)
它寫在下面,該服務MeasurementBrokerService正在使用中。

我在做什麼錯?
爲什麼推送通知需要這麼多內存? 這是什麼MeasurementBrokerService,是否可以禁用?

回答

1

你可以試試這個,

您AndroidManifest開始加入這一行:的xmlns:工具= 「http://schemas.android.com/tools」

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="cl.datacomputer.alejandrob.example" 
    xmlns:tools="http://schemas.android.com/tools"> 

和內應用程序添加此服務標籤:

<application 
    android:name="android.support.multidex.MultiDexApplication" 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" 
    android:screenOrientation="portrait"> 

    <service android:name="com.google.android.gms.measurement.AppMeasurementService" 
     tools:replace="android:enabled" 
     android:enabled="false" 
     android:exported="false"/> 

這不是一個很好的解決方案,我知道,但你可以禁用會導致內存泄漏的服務。

對不起,如果我的英語不好。

問候。

亞歷杭德羅布爾戈斯。

+0

偉大的哈克解決方案,就像一個魅力。謝謝!! –

+0

這沒什麼:) –