0

For Example:

Android source code from WifiServiceImpl.java

enter image description here

left is from Android v22 (Lollipop), right is from Android v23 (Marshmallow)

Question: if I build an apk using compile/target sdk 22, and run my application on a phone running v23 and call the method getScanResults() which one of those two methods gets called?

more info: I have an app that manages WiFi, it does most of the work in the background, it works perfectly on Lollipop and lower, but in Marshmallow, it only works if I have my application in the foreground, because getScanResults() returns an empty list if my app is in the background.

derfect
  • 622
  • 2
  • 6
  • 14
  • 1
    You're not packaging the Android OS with your application, so it has to use implementations already on the device. A v23 device will thus use the code on the right, even though you target the one on the left. – Kevin Feb 19 '16 at 09:16
  • @Kevin thanks! is there something else that plays a part in this? because my app behaves differently if I build using sdk 23, then it always returns an empty list (doesn't matter if my app is in the foreground or background) – derfect Feb 19 '16 at 09:29
  • I'm not too sure about that. [This](http://stackoverflow.com/questions/32295029/does-the-compile-sdk-affect-values-returned-by-android-functions) answer says Android can attempt to emulate older versions. it contradicts my previous comment, but I think it isn't the case here (more likely regards systems and themes, not implementations). Not sure why v23 breaks both fore and back ground for your app. – Kevin Feb 19 '16 at 09:47

0 Answers0