Comments (15)
Same problem here, anyone get this resolve ?
Edited:
I found another alternative to detect just mock Location (another detection are working), with the same way this plugin do, install Geolocator flutter plugin then use this code :
Future<bool> checkMockLocation() async {
Position position = await Geolocator().getLastKnownPosition();
return position.mocked;
}
from trust_fall.
Same problem :/
E/TSLocationManager(22678): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Timer-1
E/TSLocationManager(22678): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:807)
E/TSLocationManager(22678): at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageResponseCallback(FlutterJNI.java:740)
E/TSLocationManager(22678): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:156)
E/TSLocationManager(22678): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225)
E/TSLocationManager(22678): at com.anish.trust_fall.TrustFallPlugin$1.gotLocation(TrustFallPlugin.java:43)
E/TSLocationManager(22678): at com.anish.trust_fall.MockLocation.MockLocationCheck$GetLastLocation.run(MockLocationCheck.java:90)
E/TSLocationManager(22678): at java.util.TimerThread.mainLoop(Timer.java:562)
E/TSLocationManager(22678): at java.util.TimerThread.run(Timer.java:512)
from trust_fall.
I am also getting this error
Methods marked with @UiThread must be executed on the main thread. Current thread: Timer-0
when calling
bool canMockLocation = await TrustFall.canMockLocation;
from trust_fall.
@ENGR-ZEESHAN, Could you post output for flutter doctor
please
from trust_fall.
@anish-adm
[√] Flutter (Channel stable, v1.7.8+hotfix.3, on Microsoft Windows [Version 10.0.18362.267], locale en-PK)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
[√] VS Code (version 1.36.1)
[!] Connected device
from trust_fall.
@bagus-setyawan thanks a lot mate, this bug give me a headache.
Your code can bypass the bug
from trust_fall.
Same issue
E/AndroidRuntime( 6244): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Timer-1
E/AndroidRuntime( 6244): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:781)
E/AndroidRuntime( 6244): at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageResponseCallback(FlutterJNI.java:718)
E/AndroidRuntime( 6244): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:144)
E/AndroidRuntime( 6244): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:231)
E/AndroidRuntime( 6244): at com.anish.trust_fall.TrustFallPlugin$1.gotLocation(TrustFallPlugin.java:43)
E/AndroidRuntime( 6244): at com.anish.trust_fall.MockLocation.MockLocationCheck$GetLastLocation.run(MockLocationCheck.java:88)
E/AndroidRuntime( 6244): at java.util.TimerThread.processTask(Timer.java:577)
E/AndroidRuntime( 6244): at java.util.TimerThread.mainLoop(Timer.java:532)
E/AndroidRuntime( 6244): at java.util.TimerThread.run(Timer.java:512)
I/Process ( 6244): Sending signal. PID: 6244 SIG: 9
from trust_fall.
@anish-adm could you check this Similiar issue, ?
i think this code make error
class GetLastLocation extends TimerTask {
@Override
public void run() {
lm.removeUpdates(locationListenerGps);
lm.removeUpdates(locationListenerNetwork);
Location net_loc=null, gps_loc=null;
if(gps_enabled)
gps_loc=lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if(network_enabled)
net_loc=lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
//if there are both values use the latest one
if(gps_loc!=null && net_loc!=null){
if(gps_loc.getTime()>net_loc.getTime())
locationResult.gotLocation(gps_loc);
else
locationResult.gotLocation(net_loc);
return;
}
if(gps_loc!=null){
locationResult.gotLocation(gps_loc);
return;
}
if(net_loc!=null){
locationResult.gotLocation(net_loc);
return;
}
locationResult.gotLocation(null);
}
}
from trust_fall.
Still crashed with the latest Flutter version:
2020-09-07 16:35:51.858 19394-19683/com.mycompany.testapp E/AndroidRuntime: FATAL EXCEPTION: Timer-0
Process: com.mycompany.testapp, PID: 19394
java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Timer-0
at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:992)
at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageResponseCallback(FlutterJNI.java:779)
at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:144)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:235)
at com.anish.trust_fall.TrustFallPlugin$1.gotLocation(TrustFallPlugin.java:43)
at com.anish.trust_fall.MockLocation.MockLocationCheck$GetLastLocation.run(MockLocationCheck.java:88)
at java.util.TimerThread.processTask(Timer.java:577)
at java.util.TimerThread.mainLoop(Timer.java:532)
at java.util.TimerThread.run(Timer.java:512)
2020-09-07 16:35:52.020 19394-19505/com.mycompany.testapp D/FA: Event not sent since app measurement is disabled
2020-09-07 16:35:52.069 19394-19683/com.mycompany.testapp I/Process: Sending signal. PID: 19394 SIG: 9
from trust_fall.
Same problem here, anyone get this resolve ?
Edited:
I found another alternative to detect just mock Location (another detection are working), with the same way this plugin do, install Geolocator flutter plugin then use this code :Future<bool> checkMockLocation() async { Position position = await Geolocator().getLastKnownPosition(); return position.mocked; }
I think its now updated
Future<bool> checkMockLocation() async {
Position position = await Geolocator.getLastKnownPosition();
return position.isMocked;
}
from trust_fall.
Same problem here, anyone get this resolve ?
Edited:
I found another alternative to detect just mock Location (another detection are working), with the same way this plugin do, install Geolocator flutter plugin then use this code :Future<bool> checkMockLocation() async { Position position = await Geolocator().getLastKnownPosition(); return position.mocked; }
try to execute this code after turning off and turning on location. It gives some kind of Exception.
from trust_fall.
Is there any update on solving this error. I am also facing the same issue. I am on the latest build of TrustFall and flutter.
from trust_fall.
Same problem here, after building App in release mode.
from trust_fall.
@sunnykinger , @rp014947 , @wisnuwiry guys just use location plugin your own choice and make sure if permission permitted and get mocked properties from that, if you look into this project code you will notice that this is same way. Or you can make a fork and resolved the issue.
But once again users can pass this checker with many ways (rooted phone etc) so add another validations if your app consent is about real user's location.
from trust_fall.
Fix running on @UiThread :
@OverRide
public void onMethodCall(MethodCall call, @nonnull final Result result) {
if (call.method.equals("getPlatformVersion")) {
result.success("Android " + android.os.Build.VERSION.RELEASE);
} else if (call.method.equals("isJailBroken")) {
result.success(RootedCheck.isJailBroken(applicationContext));
} else if (call.method.equals("canMockLocation")) {
MockLocationCheck.LocationResult locationResult = new MockLocationCheck.LocationResult(){
@OverRide
public void gotLocation(final Location location){
android.os.Handler handler = new android.os.Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@OverRide
public void run() {
//Got the location!
if(location != null){
result.success(location.isFromMockProvider());
}else {
result.success(false);
}
}
});
}
};
MockLocationCheck mockLocationCheck = new MockLocationCheck();
mockLocationCheck.getLocation(applicationContext, locationResult);
}else if (call.method.equals("isRealDevice")) {
result.success(!EmulatorCheck.isEmulator());
}else if (call.method.equals("isOnExternalStorage")) {
result.success(ExternalStorageCheck.isOnExternalStorage(applicationContext));
}
else {
result.notImplemented();
}
}
Checking my github: thanhit93@8a24ca5
from trust_fall.
Related Issues (11)
- AndroidX support HOT 2
- Migration to Flutter 2 and Null safety HOT 2
- The plugin `trust_fall` uses a deprecated version of the Android embedding. HOT 2
- com.anish.trust_fall.Rooted.GreaterThan23.checkRootMethod2 (GreaterThan23.java)
- Mock location check is not working (1.0.1) HOT 2
- Add option to not check mock location HOT 2
- Permission required even when I've granted permission
- java.lang.SecurityException: uid 10159 does not have android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION. HOT 2
- [Question] Bluestack Not Detected as Emulator. Intended or Bug? HOT 1
- Null-Safety Support ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trust_fall.