What needs to be done to return true/false ?

3 answers 3

 /** * Used to determine whether the user making this call is subject to * teleportations. * @return whether the user making this call is a goat */ public boolean isUserAGoat() { return false; } 

He will never return true))

  • Hm Does the class have a sealed declaration? - VladD
  • @VladD, You can still try #define false true if it has one in Java. - Ray
  • @Andrey Baksha: no. In addition, Java does not have header files. - VladD
  • @VladD, thanks. I will know) - Ray
  • one
    > It will never return true)) The statement is not true. Such a description of the method implies its NOT MANDATORY implementation (in this case, the manufacturer of the device). In other words, it is quite possible that the phone of a self-respecting manufacturer will easily determine the transformation of the user into a goat during teleportation))) - woesss

Starting at API 21, this method checks whether the user has the com.coffeestainstudios.goatsimulator application com.coffeestainstudios.goatsimulator on the device:

 /** * Used to determine whether the user making this call is subject to * teleportations. * * <p>As of {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this method can * now automatically identify goats using advanced goat recognition technology. * </p> * * @return Returns true if the user making this call is a goat. */ public boolean isUserAGoat() { return mContext.getPackageManager() .isPackageAvailable("com.coffeestainstudios.goatsimulator"); } 

Source

In earlier versions (prior to API 21), this method always returned false , since at that time it was likely that there was no more or less adequate implementation of the goat recognition system.

    What you need to do to return true

    Install the game Goat Simulator on your device with Android 5.0+
    On earlier versions of Android, this function always returned false