android.os.BadParcelableException:ClassNotFoundException解组时:FusedLocationProvider API

android.os.BadParcelableException:ClassNotFoundException解组时:FusedLocationProvider API,android,google-maps,google-play-services,fusedlocationproviderapi,Android,Google Maps,Google Play Services,Fusedlocationproviderapi,我正在尝试使用Google FusedLocationProvider API创建背景位置跟踪器。我使用了相同的挂起意图,并创建了一个IntentService类。我还添加了一个通知,通知用户正在运行的位置跟踪器。但是,当我运行应用程序时,我看不到任何通知,而是在logcat中收到以下警告: W/Intent: Failure filling in extras android.os.BadParcelableExce

我正在尝试使用
Google FusedLocationProvider API
创建背景位置跟踪器。我使用了相同的挂起意图,并创建了一个
IntentService
类。我还添加了一个通知,通知用户正在运行的位置跟踪器。但是,当我运行应用程序时,我看不到任何通知,而是在logcat中收到以下警告:

W/Intent: Failure filling in extras
                                       android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.google.android.gms.location.LocationResult
                                           at android.os.Parcel.readParcelable(Parcel.java:2077)
                                           at android.os.Parcel.readValue(Parcel.java:1965)
                                           at android.os.Parcel.readMapInternal(Parcel.java:2226)
                                           at android.os.Bundle.unparcel(Bundle.java:223)
                                           at android.os.Bundle.putAll(Bundle.java:302)
                                           at android.content.Intent.fillIn(Intent.java:6367)
                                           at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:210)
                                           at com.android.server.am.PendingIntentRecord.send(PendingIntentRecord.java:192)
                                           at android.content.IIntentSender$Stub.onTransact(IIntentSender.java:64)
                                           at android.os.Binder.execTransact(Binder.java:351)
                                           at dalvik.system.NativeStart.run(Native Method)
我甚至无法确定我的
pendingent
是否正常工作

这是我的
IntentService
类:

public class LocationHandlerService extends IntentService {

    Location mLocation;
    NotificationManager notificationManager;

    public LocationHandlerService() {
        super("Services.LocationHandlerService");
    }


  /*  @Override
    public void setIntentRedelivery(boolean enabled) {
        super.setIntentRedelivery(true);
    }
*/
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {

        return START_NOT_STICKY;
    }


    @Override
    protected void onHandleIntent(Intent intent) {

        ResultReceiver locationReceiver = intent.getParcelableExtra(Constants.RECEIVER);

        if (LocationResult.hasResult(intent)) {

            LocationResult locationResult = LocationResult.extractResult(intent);
            mLocation = locationResult.getLastLocation();
            setupNotification();
            Bundle bundle = new Bundle();
            bundle.putParcelable(Constants.BUNDLE, mLocation);
            locationReceiver.send(Constants.RESULT_DATA_KEY, bundle);

        }
    }

    //Setup Notification
    private void setupNotification() {

        final Intent notificationIntent = new Intent(getApplicationContext(), MainActivity.class);
        notificationIntent.addCategory("android.intent.category.LAUNCHER");

        final PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
        notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        NotificationCompat.Builder notification = new NotificationCompat.Builder(getApplicationContext())
                .setSmallIcon(R.drawable.location_start_notification)
                .setOngoing(true)
                .setPriority(Notification.PRIORITY_DEFAULT)
                .setContentTitle(getResources().getString(R.string.location_notification))
                .setContentText("Lat: " + mLocation.getLatitude() + ", Long: " + mLocation.getLongitude())
                .setContentIntent(pendingIntent);

        notificationManager.notify(1, notification.build());

    }

    @Override
    public void onDestroy() {

        stopForeground(true);

    }

    // Creating constants to report the results of the Location Update process
    public final class Constants {

        public static final String PACKAGE_NAME = "com.svtech.thirdeye.thirdeye";
        public static final String RECEIVER = PACKAGE_NAME + ".RECEIVER";
        public static final int RESULT_DATA_KEY = 9;
        public static final String BUNDLE = PACKAGE_NAME + ".BUNDLE";
    }

}

有人能帮忙吗???

我在Android 4.2.2上运行它,API 17@Ironmansearch在谷歌上有很多类似的问题。我在谷歌上搜索了它,发现了这样一个问题:我如何找出这是谷歌API还是我的代码的问题???我找不到一个可行的解决方案…@IronmanI我认为这是一个bug。这是否意味着我不能使用
FusedLocationAPI
在后台运行位置跟踪器@铁人