-3

I have an Android app.

This program can detect fake positions.

But I want to avoid this problem by using Java programming.

Please help me.

Thanks

1 Answers1

0
public static boolean isMockLocation(Location location) {
    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && location != null && location.isFromMockProvider();
}

//pass your location object here.
if(isMockLocation(location)){
//Restrict user
}elese{
//do whatever you want.
}