Java 绑定到服务时Android应用程序因权限问题崩溃
我试图扩展binder类以调用我的服务中的方法,但无法获得与意图过滤器匹配的意图。有两种情况Java 绑定到服务时Android应用程序因权限问题崩溃,java,android,permissions,intentfilter,bindservice,Java,Android,Permissions,Intentfilter,Bindservice,我试图扩展binder类以调用我的服务中的方法,但无法获得与意图过滤器匹配的意图。有两种情况 如果我按以下方式设置我的意图,bindService返回true,startService返回组件信息,服务启动,但应用程序立即崩溃: private LocationUpdateService mService; Activity activity = this.cordova.getActivity(); updateServiceIntent = new Intent(activity, Loca
private LocationUpdateService mService;
Activity activity = this.cordova.getActivity();
updateServiceIntent = new Intent(activity, LocationUpdateService.class);
Boolean successful = activity.bindService(updateServiceIntent, mConnection, Context.BIND_AUTO_CREATE);
ComponentName serviceStarted = activity.startService(updateServiceIntent);
private LocationUpdateService mService;
Activity activity = this.cordova.getActivity();
updateServiceIntent = new Intent("com.tentforwardconsulting.cordova.bgloc.LocationUpdateService");
Boolean successful = activity.bindService(updateServiceIntent, mConnection, Context.BIND_AUTO_CREATE);
ComponentName serviceStarted = activity.startService(updateServiceIntent);
ContextImpl( 704): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1510 com.android.server.StatusBarManagerService.sendNotification:981 com.android.server.StatusBarManagerService.removeNotification:706 com.android.server.NotificationManagerService.cancelNotificationLocked:2455 com.android.server.NotificationManagerService.access$5100:160
My androidManifest.xml具有以下意图过滤器设置。我试图捕捉我的两种意图设置:
<activity android:name="com.tentforwardconsulting.cordova.bgloc.BackgroundGpsPlugin">
<intent-filter>
<action android:name="com.tentforwardconsulting.cordova.bgloc.LocationUpdateService" />
<action android:name="LocationUpdateService" />
</intent-filter>
</activity>
<service android:enabled="true" android:name="com.tenforwardconsulting.cordova.bgloc.LocationUpdateService" android:process=":remote" />
请让我知道您可能有什么疑难解答的想法。我已经玩了一段时间的意图和意图过滤器的组合。我真的很感激任何帮助 “但应用程序立即崩溃”--使用LogCat检查与崩溃相关的Java堆栈跟踪:“如果我按以下方式设置我的意图,bindService将返回false,服务不会启动,应用程序不会崩溃”--这是因为它与您的服务不匹配。您的服务没有
。“无论哪种方式,logcat都会显示以下错误”--这不是来自您的应用程序。感谢您的帮助。我一直在用LogCat。我在那里看到了另一个错误:java.lang.ClassCastException:android.os.BinderProxy无法转换为com.tenforwardconsulting.cordova.bgloc.LocationUpdateService$LocalBinder
。我认为这是因为我的服务被指定在远程进程中运行,所以我不能仅仅扩展binder类。我想我将不得不使用信使或AIDL。悲伤的一天!谢谢你的帮助。