Aminoid / react-native-activity-recognition

React Native wrapper for the Activity Recognition API.
GNU General Public License v2.0
95 stars 79 forks source link

Incompatible Types: Inferred type does not conform to upper bound(s) #11

Closed aswinramakrish closed 6 years ago

aswinramakrish commented 6 years ago

Here is the version I'm using -

react: "^16.4.0"
react-native: "^0.52.2"
react-native-activity-recognition: "^3.2.0"

Issue

I kept getting the following error while building -

ActivityRecognizer.java:203 - Error: incompatible types - inferred type does not conform to upper bound(s)
ArrayList<DetectedActivity> updatedActivities = intent.getParcelableArrayListExtra(DetectionService.ACTIVITY_EXTRA);
                                                       ^
Inferred: DetectedActivity
Upper bound(s): Parcelable

Solution

I was able to fix this by changing line 203 to this -

ArrayList<DetectedActivity> updatedActivities = (ArrayList<DetectedActivity>) intent.getParcelableExtra(DetectionService.ACTIVITY_EXTRA);

Just wanted to report it here, so it helps someone.

🍻