0
내 응용 프로그램에서 bindService를 수행하려고하면 다음 오류가 발생합니다. 안드로이드 소스 코드로 작업 중이며, 바인딩하려고하는이 서비스가 다른 곳에서 시작되지 않았 음을 확신합니다. 설정 -> 응용 프로그램 -> 실행을 통해이를 확인했으며 실행중인 서비스가 표시됩니다.bindservice 중 예외
01-02 00:06:54.531: INFO/PowerManagerService(425): Start Light.setBrightness(), [20], [3]
01-02 00:06:56.473: INFO/PowerManagerService(425): Start Light.setBrightness(), [130], [3]
01-02 00:06:58.055: WARN/dalvikvm(4956): threadid=1: thread exiting with uncaught exception (group=0x40b70390)
01-02 00:06:58.055: WARN/ActivityManager(425): Permission Denial: Accessing service ComponentInfo{jp.co.abc.android.omrsettings/jp.co.xyz.bluetooth.profile.TIPServer} from pid=4956, uid=10158 requires jp.co.abc.android.OMRSettings.permission.Access
01-02 00:06:58.065: ERROR/AndroidRuntime(4956): FATAL EXCEPTION: main
java.lang.SecurityException: Not allowed to bind to service Intent { act=jp.co.xyz.bluetooth.api.ITimeServer }
at android.app.ContextImpl.bindService(ContextImpl.java:1187)
at android.content.ContextWrapper.bindService(ContextWrapper.java:370)
at jp.co.abc.middleware.tip.LeTimeServerProfile.startTimeServer(LeTimeServerProfile.java:45)
at jp.co.abc.tip.TimeActivity.onClick(TimeActivity.java:49)
at android.view.View.performClick(View.java:3511)
at android.view.View$PerformClick.run(View.java:14133)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at dalvik.system.NativeStart.main(Native Method)
01-02 00:06:58.095: WARN/ActivityManager(425): Force finishing activity jp.co.abc.tip/.TimeActivity
이상한 부분 I는 장치에서 특정 응용 프로그램을 제거 할 때 이러한 오류가 발생하지 않기 때문이다. 누군가이 응용 프로그램이있는 상태에서이 오류가 발생하는 이유를 알려 주실 수 있습니까?이 응용 프로그램을 제거하지 마십시오.
도움을 주시면 감사하겠습니다.
mContext.bindService(new Intent("jp.co.xyz.bluetooth.api.ITimeServer"), time_connection, Context.BIND_AUTO_CREATE);
ServiceConnection time_connection = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service){
mTime = ITimeServer.Stub.asInterface(service);
try {
mTime.startTIPServer(callback,Constants.TIME_SOURCE_CELLULAR_NETWORK,46);
} catch (RemoteException e) {
Log.e(TAG, " startTIPServer error ");
}
}
public void onServiceDisconnected(ComponentName name){
mTime = null;
}
};
코드를 추가하십시오 .... – user4232
추가 코드를 편집하십시오 – Anu