paulkavule / seek-for-android

Automatically exported from code.google.com/p/seek-for-android
0 stars 0 forks source link

The implicit intent used in Context.bindService() caused an exception on Android 5.0 #88

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Due to Android 5.0 changes (Binding to a Service at 
http://developer.android.com/about/versions/android-5.0-changes.html#BindService
), the current version of Smartcard Service does NOT seem to work well, and 
causes the following exception:

D/AndroidRuntime(15142): Shutting down VM
--------- beginning of crash
E/AndroidRuntime(15142): FATAL EXCEPTION: main
E/AndroidRuntime(15142): Process: com.android.TestSeekApp, PID: 15142
E/AndroidRuntime(15142): java.lang.IllegalArgumentException: Service Intent 
must be explicit: Intent { 
act=org.simalliance.openmobileapi.service.ISmartcardService }
E/AndroidRuntime(15142):        at 
android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
E/AndroidRuntime(15142):        at 
android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
E/AndroidRuntime(15142):        at 
android.app.ContextImpl.bindService(ContextImpl.java:1751)
E/AndroidRuntime(15142):        at 
android.content.ContextWrapper.bindService(ContextWrapper.java:538)
E/AndroidRuntime(15142):        at 
org.simalliance.openmobileapi.SEService.<init>(SEService.java:134)
E/AndroidRuntime(15142):        at 
com.android.TestSeekApp.MainActivity.startService(MainActivity.java:171)
E/AndroidRuntime(15142):        at 
com.android.TestSeekApp.MainActivity.access$0(MainActivity.java:164)
E/AndroidRuntime(15142):        at 
com.android.TestSeekApp.MainActivity$1.onClick(MainActivity.java:115)
E/AndroidRuntime(15142):        at 
android.view.View.performClick(View.java:4756)
E/AndroidRuntime(15142):        at 
android.view.View$PerformClick.run(View.java:19749)
E/AndroidRuntime(15142):        at 
android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime(15142):        at 
android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(15142):        at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(15142):        at 
android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime(15142):        at java.lang.reflect.Method.invoke(Native 
Method)
E/AndroidRuntime(15142):        at 
java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(15142):        at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime(15142):        at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
D/audio_hw_primary( 1413): out_set_parameters: enter: usecase(1: 
low-latency-playback) kvpairs: routing=2

Original issue reported on code.google.com by danny.w....@gmail.com on 3 Dec 2014 at 4:54

GoogleCodeExporter commented 9 years ago
Here is the solution from one of major Android device vendors:

The fix in SEService.java is:

-        boolean bindingSuccessful = mContext.bindService(new 
Intent(ISmartcardService.class
-                .getName()), mConnection, Context.BIND_AUTO_CREATE);

+        Intent serviceIntent = new Intent(ISmartcardService.class.getName());
+        serviceIntent.setClassName("org.simalliance.openmobileapi.service",
+                                   
"org.simalliance.openmobileapi.service.SmartcardService");
+        boolean bindingSuccessful = mContext.bindService(serviceIntent, 
mConnection, Context.BIND_AUTO_CREATE);

Original comment by danny.w....@gmail.com on 4 Dec 2014 at 6:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
i need this fix for my company.
any release scheduled for thi fix?

this fix need only update software from repository 
(https://seek-for-android.googlecode.com/svn/trunk/repository/) or it needs rom 
device update?

Original comment by xan.scale on 24 Feb 2015 at 10:00

GoogleCodeExporter commented 9 years ago
using android:targetSdkVersion="19" works

Original comment by xan.scale on 25 Feb 2015 at 4:41