anhtuan98 / uitanpr2

27 stars 26 forks source link

not working on 5.0 and higher #8

Open binhjy opened 8 years ago

binhjy commented 8 years ago

Hi tuan, is this app doesn't work on smartphone version 5.0 and higher? When i use, it's crashed about 5 seconds.

virenderjangra commented 7 years ago

Same here, Is anyone able to compile for version 5 and above ?

juliansteenbakker commented 7 years ago

You can replace the function initOpenCv inside AsyncServiceHelper, with this to make the intent explicit:

public static boolean initOpenCV(String Version, final Context AppContext, final LoaderCallbackInterface Callback) { AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback); Intent intent = new Intent("org.opencv.engine.BIND"); intent.setPackage("org.opencv.engine"); if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE)) { return true; } else { AppContext.unbindService(helper.mServiceConnection); InstallService(AppContext, Callback); return false; } }

Source: http://stackoverflow.com/questions/27470313/opencv-service-intent-must-be-explicit-android-5-0-lolipop

mmelatti commented 7 years ago

Thanks this worked like a charm! my app was crashing before it could even start up. However, now my app is crashing after about 5 seconds of runtime. I haven't made any changes to the code other than the initOpenCv. It crashes 5 seconds after startup on my Sammy S5 and almost immediately on my Sammy S8. Thanks!

risonaldomoura commented 6 years ago

Hi there. In class AsyncServiceHelper, set the instalation package. Do:

AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback); Intent intent = new Intent("org.opencv.engine.BIND"); intent.setPackage("org.opencv.engine"); if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE))