How to find out from code if my Android app runs on emulator or real device?

后端 未结 9 2241

I have read this stackoverflow thread already and I tried using the code given in that answer to find out if I run my code on the emulator or on a real device:



        
9条回答
  •  旧巷少年郎
    2020-12-09 18:04

    I think that the best answer is to decide why you actually care to know - and then check for whatever specific characteristic of the emulator you believe requires that your app behave differently than it would on a device.

提交回复
热议问题