Android app crashing with permissions issues when binding to service

981 views Asked by At

I'm trying to extend the binder class to call a method in my service but can't get the intents to match the intent filters. There are two scenarios.

  1. If I setup my intent as below, bindService returns true, startService returns Component Info and the service starts but the app immediately crashes:

    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);
    
  2. If I setup my intent as below, bindService returns false, the service doesn't start, and the app doesn't crash.

    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);
    

Either way, logcat displays the following error:

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 has the following intent-filters setup. I tried to catch both of my intent setups:

<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" />

Please let me know any troubleshooting ideas you may have. I've been playing with combinations of intent and intent-filters for a while now. I really appreciate any help!

0

There are 0 answers