1

I have a problem. My app use 20MB of ram so I want to avoid mobile phone that have heap less than 20MB. I tried with Runtime.getRuntime.maxMemory() but this function retrieve me the wrong result (256MB on SGS3) because I want to retrieve the available heap for a single app.

How can I detect it? There is an attribute in the manifest?

Thanks.

trincot
  • 263,463
  • 30
  • 215
  • 251
David Martinelli
  • 223
  • 6
  • 16

1 Answers1

1

What you need is getMemoryClass

 ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();

it returns the approximate per-application memory class of the current device.

Blackbelt
  • 152,872
  • 27
  • 286
  • 297