2016-09-29 41 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

这没什么:) –