Skip to content

Commit

Permalink
Merge pull request #233 from shankari/fix_foreground_service
Browse files Browse the repository at this point in the history
⬆️ API 35: foreground service permissions + restricted broadcast event
  • Loading branch information
shankari authored Aug 28, 2024
2 parents 68d7f83 + 01c746e commit 1a22eef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
id="cordova-plugin-em-datacollection"
version="1.8.8">
version="1.8.9">

<name>DataCollection</name>
<description>Background data collection FTW! This is the part that I really
Expand Down Expand Up @@ -54,6 +54,8 @@
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<!-- COARSE_LOCATION obfuscates the location to a city block, change to FINE_LOCATION for accuracy -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
Expand Down Expand Up @@ -109,7 +111,7 @@
<service
android:name="edu.berkeley.eecs.emission.cordova.tracker.location.TripDiaryStateMachineForegroundService"
android:enabled="true"
android:foregroundServiceType="location"
android:foregroundServiceType="location|health"
android:exported="false">
</service>
<service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ protected void onHandleIntent(Intent intent) {

private void broadcastLoc(Location loc) {
Intent answerIntent = new Intent(INTENT_NAME);
answerIntent.setPackage(this.getPackageName());
answerIntent.putExtra(INTENT_RESULT_KEY, loc);
Log.i(this, TAG, "broadcasting intent "+answerIntent);
LocalBroadcastManager.getInstance(this).sendBroadcast(answerIntent);
Expand Down

0 comments on commit 1a22eef

Please sign in to comment.