Mapbox-gl-native: ConnectivityManager leak in MainActivity

Created on 12 Jan 2016  路  7Comments  路  Source: mapbox/mapbox-gl-native

device-2016-01-12-153541

Android

Most helpful comment

I have identified that this line is the problem:

ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

This leak can be prevented if we replace above with:

ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext()
                .getSystemService(Context.CONNECTIVITY_SERVICE);

All 7 comments

I believe this is rather an Android SDK issue than a Mapbox one..

I have created an issue on issue tracker of LeakCanary as in the AOSP issue tracker

There is currently nothing actionable to do for us. closing.

I have identified that this line is the problem:

ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

This leak can be prevented if we replace above with:

ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext()
                .getSystemService(Context.CONNECTIVITY_SERVICE);

This will land in the release branch of 3.1.0 in #3537.

This landed with 5ff95d4 in branch mentioned above.

@tobrun thanks man , i was stuck on this problem , life saver

Was this page helpful?
0 / 5 - 0 ratings