Compare commits
6 Commits
v1.6.25
...
56806f0349
Author | SHA1 | Date | |
---|---|---|---|
56806f0349 | |||
7127ac45bc | |||
8a43741b21 | |||
b7ebf2cdcd | |||
054ab6d84b | |||
47b56d4978 |
@ -11,8 +11,8 @@ android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
versionCode 100
|
||||
versionName "1.6.24"
|
||||
versionCode 101
|
||||
versionName "1.6.25"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
@ -10,8 +10,8 @@
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"versionCode": 98,
|
||||
"versionName": "1.6.22-googlePlay",
|
||||
"versionCode": 101,
|
||||
"versionName": "1.6.25-googlePlay",
|
||||
"outputFile": "app-googlePlayFlavor-release.apk"
|
||||
}
|
||||
]
|
||||
|
@ -62,6 +62,7 @@
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"/>
|
||||
|
||||
<!-- Commented out because of Google Play policy -->
|
||||
|
||||
@ -203,6 +204,17 @@
|
||||
|
||||
<service android:name=".location.GeofenceIntentService"/>
|
||||
|
||||
<service android:name=".receivers.NotificationListener"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.service.notification.default_filter_types"
|
||||
android:value="1,2">
|
||||
</meta-data>
|
||||
</service>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -273,32 +273,40 @@ public class ReceiverCoordinator
|
||||
|
||||
if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection))
|
||||
{
|
||||
boolean isRunning = (Boolean)Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "isActivityDetectionReceiverRunning", null);
|
||||
if(isRunning)
|
||||
Object runResult = Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "isActivityDetectionReceiverRunning", null);;
|
||||
if(runResult instanceof Boolean)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "LocationProvider", "Restarting ActivityDetectionReceiver because used in a new/changed rule.", 4);
|
||||
boolean haveAllPerms = (Boolean)Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null);
|
||||
if(haveAllPerms)
|
||||
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "restartActivityDetectionReceiver", null);
|
||||
boolean isRunning = (Boolean) runResult;
|
||||
if (isRunning)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "LocationProvider", "Restarting ActivityDetectionReceiver because used in a new/changed rule.", 4);
|
||||
boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null);
|
||||
if (haveAllPerms)
|
||||
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "restartActivityDetectionReceiver", null);
|
||||
// ActivityDetectionReceiver.restartActivityDetectionReceiver();
|
||||
}
|
||||
else
|
||||
{
|
||||
Miscellaneous.logEvent("i", "LocationProvider", "Starting ActivityDetectionReceiver because used in a new/changed rule.", 4);
|
||||
boolean haveAllPerms = (Boolean)Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null);
|
||||
if(haveAllPerms)
|
||||
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "startActivityDetectionReceiver", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
Miscellaneous.logEvent("i", "LocationProvider", "Starting ActivityDetectionReceiver because used in a new/changed rule.", 4);
|
||||
boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null);
|
||||
if (haveAllPerms)
|
||||
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "startActivityDetectionReceiver", null);
|
||||
// ActivityDetectionReceiver.startActivityDetectionReceiver();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean isRunning = (Boolean)Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "isActivityDetectionReceiverRunning", null);
|
||||
if(isRunning)
|
||||
Object runResult = Miscellaneous.runMethodReflective(activityDetectionClassPath, "isActivityDetectionReceiverRunning", null);
|
||||
if(runResult instanceof Boolean)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "LocationProvider", "Shutting down ActivityDetectionReceiver because not used in any rule.", 4);
|
||||
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null);
|
||||
boolean isRunning = (Boolean) runResult;
|
||||
if (isRunning)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "LocationProvider", "Shutting down ActivityDetectionReceiver because not used in any rule.", 4);
|
||||
Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null);
|
||||
// ActivityDetectionReceiver.stopActivityDetectionReceiver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
package com.jens.automation2.receivers;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.service.notification.NotificationListenerService;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
@SuppressLint("OverrideAbstract")
|
||||
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
public class NotificationListener extends NotificationListenerService
|
||||
{
|
||||
static NotificationListener instance;
|
||||
|
||||
|
||||
public static boolean startNotificationListenerService()
|
||||
{
|
||||
if(instance == null)
|
||||
instance = new NotificationListener();
|
||||
|
||||
instance.c
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate()
|
||||
{
|
||||
super.onCreate();
|
||||
nlservicereciver = new NLServiceReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction("com.kpbird.nlsexample.NOTIFICATION_LISTENER_SERVICE_EXAMPLE");
|
||||
registerReceiver(nlservicereciver,filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotificationPosted(StatusBarNotification sbn)
|
||||
{
|
||||
super.onNotificationPosted(sbn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap)
|
||||
{
|
||||
super.onNotificationPosted(sbn, rankingMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListenerConnected()
|
||||
{
|
||||
super.onListenerConnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListenerDisconnected()
|
||||
{
|
||||
super.onListenerDisconnected();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:4.1.2"
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
1
fastlane/metadata/android/en-US/changelogs/101.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/101.txt
Normal file
@ -0,0 +1 @@
|
||||
Fixed bug that crashed the app when saving rules while the service was running.
|
Reference in New Issue
Block a user