Notification trigger.
This commit is contained in:
parent
7894504791
commit
fb44196a0d
@ -210,7 +210,7 @@
|
||||
|
||||
<service
|
||||
android:name=".receivers.NotificationListener"
|
||||
android:label="NotificationListener"
|
||||
android:label="@string/app_name"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
|
@ -186,7 +186,7 @@
|
||||
|
||||
<service
|
||||
android:name=".receivers.NotificationListener"
|
||||
android:label="NotificationListener"
|
||||
android:label="@string/app_name"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
|
@ -181,7 +181,7 @@
|
||||
|
||||
<service
|
||||
android:name=".receivers.NotificationListener"
|
||||
android:label="NotificationListener"
|
||||
android:label="@string/app_name"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
|
@ -215,9 +215,9 @@ public class Action
|
||||
{
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.wakeupDevice));
|
||||
}
|
||||
else if(this.getAction().equals(Action_Enum.playMusic))
|
||||
else if(this.getAction().equals(Action_Enum.playSound))
|
||||
{
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound) + " " + getParameter2());
|
||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.playSound) + ": " + getParameter2());
|
||||
}
|
||||
else
|
||||
returnString.append(action.toString());
|
||||
|
@ -1255,6 +1255,29 @@ public class ActivityManageRule extends Activity
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeActionPlaySoundAdd)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
newAction.setParameter1(data.getBooleanExtra("actionParameter1", false));
|
||||
newAction.setParameter2(String.valueOf(data.getIntExtra("actionParameter2", 0)));
|
||||
ruleToEdit.getActionSet().add(newAction);
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
else if(requestCode == requestCodeActionPlaySoundEdit)
|
||||
{
|
||||
if(resultCode == RESULT_OK)
|
||||
{
|
||||
if(data.hasExtra("actionParameter1"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter1(data.getBooleanExtra("actionParameter1", false));
|
||||
|
||||
if(data.hasExtra("actionParameter2"))
|
||||
ruleToEdit.getActionSet().get(editIndex).setParameter2(String.valueOf(data.getIntExtra("actionParameter2", 0)));
|
||||
|
||||
this.refreshActionList();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Check with has data been changed or something like that.
|
||||
/*try
|
||||
|
@ -1443,6 +1443,8 @@ public class ActivityPermissions extends Activity
|
||||
}
|
||||
|
||||
public static Boolean verifyNotificationPermission()
|
||||
{
|
||||
try
|
||||
{
|
||||
String theList = android.provider.Settings.Secure.getString(Miscellaneous.getAnyContext().getContentResolver(), "enabled_notification_listeners");
|
||||
String[] theListList = theList.split(":");
|
||||
@ -1454,4 +1456,9 @@ public class ActivityPermissions extends Activity
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -899,6 +899,8 @@ public class XmlFileInterface
|
||||
newTrigger.setTriggerType(Trigger_Enum.bluetoothConnection);
|
||||
else if(triggerEventString.equals("headsetPlugged"))
|
||||
newTrigger.setTriggerType(Trigger_Enum.headsetPlugged);
|
||||
else if(triggerEventString.equals("notification"))
|
||||
newTrigger.setTriggerType(Trigger_Enum.notification);
|
||||
}
|
||||
else if (name.equals("TriggerParameter1"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user