Notification action
This commit is contained in:
@ -8,7 +8,6 @@ import android.app.PendingIntent;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothManager;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
@ -28,7 +27,6 @@ import android.telephony.SmsManager;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
@ -92,7 +90,7 @@ public class Actions
|
||||
{
|
||||
String title = Miscellaneous.replaceVariablesInText(elements[0], Miscellaneous.getAnyContext());
|
||||
String text = Miscellaneous.replaceVariablesInText(elements[1], Miscellaneous.getAnyContext());
|
||||
Miscellaneous.createDismissableNotification(title, text, notificationId, null);
|
||||
Miscellaneous.createDismissibleNotification(title, text, notificationId, false, AutomationService.NOTIFICATION_CHANNEL_ID_RULES, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ public class ActivityPermissions extends Activity
|
||||
break;
|
||||
case sendTextMessage:
|
||||
addToArrayListUnique(Manifest.permission.SEND_SMS, requiredPermissions);
|
||||
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
||||
getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions);
|
||||
break;
|
||||
case setAirplaneMode:
|
||||
addToArrayListUnique(Manifest.permission.WRITE_SETTINGS, requiredPermissions);
|
||||
@ -588,7 +588,7 @@ public class ActivityPermissions extends Activity
|
||||
// addToArrayListUnique("android.permission.TETHER_PRIVILEGED", requiredPermissions);
|
||||
break;
|
||||
case speakText:
|
||||
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
||||
getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions);
|
||||
break;
|
||||
case startOtherActivity:
|
||||
if(
|
||||
@ -608,7 +608,7 @@ public class ActivityPermissions extends Activity
|
||||
break;
|
||||
case triggerUrl:
|
||||
addToArrayListUnique(Manifest.permission.INTERNET, requiredPermissions);
|
||||
checkPermissionsInVariableUse(action.getParameter2(), requiredPermissions);
|
||||
getPermissionsForVariablesInUse(action.getParameter2(), requiredPermissions);
|
||||
break;
|
||||
case turnBluetoothOff:
|
||||
addToArrayListUnique(Manifest.permission.BLUETOOTH_ADMIN, requiredPermissions);
|
||||
@ -1150,7 +1150,7 @@ public class ActivityPermissions extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
static ArrayList<String> checkPermissionsInVariableUse(String text, ArrayList<String> permsList)
|
||||
static ArrayList<String> getPermissionsForVariablesInUse(String text, ArrayList<String> permsList)
|
||||
{
|
||||
/*
|
||||
[uniqueid]
|
||||
|
@ -41,8 +41,16 @@ public class AutomationService extends Service implements OnInitListener
|
||||
protected final static int notificationIdRestrictions = 1005;
|
||||
protected final static int notificationIdLocationRestriction = 1006;
|
||||
|
||||
final static String NOTIFICATION_CHANNEL_ID = "com.jens.automation2";
|
||||
final static String channelName = "Service notification";
|
||||
// final static String NOTIFICATION_CHANNEL_ID = "com.jens.automation2";
|
||||
|
||||
final static String NOTIFICATION_CHANNEL_ID_SERVICE = "com.jens.automation2_service";
|
||||
final static String NOTIFICATION_CHANNEL_NAME_SERVICE = "Service notification";
|
||||
|
||||
final static String NOTIFICATION_CHANNEL_ID_FUNCTIONALITY = "com.jens.automation2_functionality";
|
||||
final static String NOTIFICATION_CHANNEL_NAME_FUNCTIONALITY = "Functionality information";
|
||||
|
||||
final static String NOTIFICATION_CHANNEL_ID_RULES = "com.jens.automation2_rules";
|
||||
final static String NOTIFICATION_CHANNEL_NAME_RULES = "Rule notifications";
|
||||
|
||||
protected static Notification myNotification;
|
||||
protected static NotificationCompat.Builder notificationBuilder = null;
|
||||
@ -205,7 +213,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
Intent myIntent = new Intent(this, ActivityMainTabLayout.class);
|
||||
myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, 0);
|
||||
notificationBuilder = createDefaultNotificationBuilder();
|
||||
notificationBuilder = createServiceNotificationBuilder();
|
||||
|
||||
updateNotification();
|
||||
|
||||
@ -365,9 +373,9 @@ public class AutomationService extends Service implements OnInitListener
|
||||
Miscellaneous.logEvent("w", "Features disabled", "Features disabled because of rule " + rule, 5);
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||
Miscellaneous.createDismissableNotificationWithDelay(1010, null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi);
|
||||
Miscellaneous.createDismissibleNotificationWithDelay(1010, null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
|
||||
else
|
||||
Miscellaneous.createDismissableNotification(null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, pi);
|
||||
Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), ActivityPermissions.notificationIdPermissions, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -389,9 +397,9 @@ public class AutomationService extends Service implements OnInitListener
|
||||
Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5);
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||
Miscellaneous.createDismissableNotificationWithDelay(3300, null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi);
|
||||
Miscellaneous.createDismissibleNotificationWithDelay(3300, null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
|
||||
else
|
||||
Miscellaneous.createDismissableNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, pi);
|
||||
Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdRestrictions, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -411,9 +419,9 @@ public class AutomationService extends Service implements OnInitListener
|
||||
Miscellaneous.logEvent("w", "Features disabled", "Background location disabled because Google to blame.", 5);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1)
|
||||
Miscellaneous.createDismissableNotificationWithDelay(2200, null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||
Miscellaneous.createDismissibleNotificationWithDelay(2200, null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
|
||||
else
|
||||
Miscellaneous.createDismissableNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, pi);
|
||||
Miscellaneous.createDismissibleNotification(null, getResources().getString(R.string.featuresDisabled), notificationIdLocationRestriction, false, AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, pi);
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,7 +490,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected static NotificationCompat.Builder createDefaultNotificationBuilder()
|
||||
protected static NotificationCompat.Builder createServiceNotificationBuilder()
|
||||
{
|
||||
NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
@ -490,14 +498,14 @@ public class AutomationService extends Service implements OnInitListener
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
{
|
||||
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW);
|
||||
// chan.setLightColor(Color.BLUE);
|
||||
chan.enableVibration(false);
|
||||
chan.setSound(null, null);
|
||||
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
mNotificationManager.createNotificationChannel(chan);
|
||||
NotificationChannel channel = Miscellaneous.getNotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE);
|
||||
// channel.setLightColor(Color.BLUE);
|
||||
channel.enableVibration(false);
|
||||
channel.setSound(null, null);
|
||||
channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
mNotificationManager.createNotificationChannel(channel);
|
||||
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID);
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID_SERVICE);
|
||||
}
|
||||
else
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance());
|
||||
@ -576,7 +584,7 @@ public class AutomationService extends Service implements OnInitListener
|
||||
String textToDisplay = bodyText + " " + lastRuleString;
|
||||
|
||||
if(notificationBuilder == null)
|
||||
notificationBuilder = createDefaultNotificationBuilder();
|
||||
notificationBuilder = createServiceNotificationBuilder();
|
||||
|
||||
notificationBuilder.setContentText(textToDisplay);
|
||||
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||
|
@ -8,7 +8,6 @@ import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.ContentProvider;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
@ -16,6 +15,8 @@ import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.Cursor;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
@ -26,7 +27,6 @@ import android.os.IBinder;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
@ -83,6 +83,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
@ -98,13 +99,10 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.documentfile.provider.DocumentFile;
|
||||
|
||||
import static android.provider.CalendarContract.CalendarCache.URI;
|
||||
import static com.jens.automation2.AutomationService.NOTIFICATION_CHANNEL_ID;
|
||||
import static com.jens.automation2.AutomationService.channelName;
|
||||
|
||||
public class Miscellaneous extends Service
|
||||
{
|
||||
protected static String writeableFolderStringCache = null;
|
||||
@ -877,7 +875,7 @@ public class Miscellaneous extends Service
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void createDismissableNotificationWithDelay(long delay, String title, String textToDisplay, int notificationId, PendingIntent pendingIntent)
|
||||
public static void createDismissibleNotificationWithDelay(long delay, String title, String textToDisplay, int notificationId, String notificationChannelId, PendingIntent pendingIntent)
|
||||
{
|
||||
/*
|
||||
Now what's this about?
|
||||
@ -903,7 +901,7 @@ public class Miscellaneous extends Service
|
||||
catch(Exception e)
|
||||
{}
|
||||
|
||||
createDismissableNotification(title, textToDisplay, notificationId, pendingIntent);
|
||||
createDismissibleNotification(title, textToDisplay, notificationId, true, notificationChannelId, pendingIntent);
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -924,46 +922,82 @@ public class Miscellaneous extends Service
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void createDismissableNotification(String title, String textToDisplay, int notificationId, PendingIntent pendingIntent)
|
||||
public static void createDismissibleNotification(String title, String textToDisplay, int notificationId, boolean vibrate, String notificationChannelId, PendingIntent pendingIntent)
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
{
|
||||
createDismissableNotificationSdk26(title, textToDisplay, notificationId, pendingIntent);
|
||||
createDismissibleNotificationSdk26(title, textToDisplay, notificationId, vibrate, notificationChannelId, pendingIntent);
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationManager mNotificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
NotificationCompat.Builder dismissableNotificationBuilder = createDismissableNotificationBuilder(pendingIntent);
|
||||
NotificationCompat.Builder dismissibleNotificationBuilder = createDismissibleNotificationBuilder(vibrate, notificationChannelId, pendingIntent);
|
||||
|
||||
if(title == null)
|
||||
dismissableNotificationBuilder.setContentTitle(AutomationService.getInstance().getResources().getString(R.string.app_name));
|
||||
dismissibleNotificationBuilder.setContentTitle(AutomationService.getInstance().getResources().getString(R.string.app_name));
|
||||
else
|
||||
dismissableNotificationBuilder.setContentTitle(title);
|
||||
dismissibleNotificationBuilder.setContentTitle(title);
|
||||
|
||||
dismissableNotificationBuilder.setContentText(textToDisplay);
|
||||
dismissableNotificationBuilder.setContentIntent(pendingIntent);
|
||||
dismissableNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||
dismissableNotificationBuilder.setAutoCancel(true);
|
||||
dismissibleNotificationBuilder.setContentText(textToDisplay);
|
||||
dismissibleNotificationBuilder.setContentIntent(pendingIntent);
|
||||
dismissibleNotificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||
dismissibleNotificationBuilder.setAutoCancel(true);
|
||||
|
||||
Notification dismissableNotification = dismissableNotificationBuilder.build();
|
||||
if(notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_RULES))
|
||||
dismissibleNotificationBuilder.setSmallIcon(R.drawable.info);
|
||||
|
||||
mNotificationManager.notify(notificationId, dismissableNotification);
|
||||
Notification dismissibleNotification = dismissibleNotificationBuilder.build();
|
||||
|
||||
/*NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
|
||||
.setSmallIcon(R.drawable.ic_launcher) // notification icon
|
||||
.setContentTitle("Notification!") // title for notification
|
||||
.setContentText("Hello word") // message for notification
|
||||
.setAutoCancel(true); // clear notification after click
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
PendingIntent pi = PendingIntent.getActivity(this,0,intent,Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mBuilder.setContentIntent(pi);
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
mNotificationManager.notify(0, dismissableNotification);*/
|
||||
mNotificationManager.notify(notificationId, dismissibleNotification);
|
||||
}
|
||||
|
||||
static void createDismissableNotificationSdk26(String title, String textToDisplay, int notificationId, PendingIntent pendingIntent)
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
static NotificationChannel findExistingChannel(List<NotificationChannel> channels, String channelId)
|
||||
{
|
||||
for(NotificationChannel c : channels)
|
||||
{
|
||||
if(c.getId().equals(channelId))
|
||||
return c;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
static NotificationChannel getNotificationChannel(String channelId)
|
||||
{
|
||||
NotificationManager nm = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
List<NotificationChannel> channels = nm.getNotificationChannels();
|
||||
if(channels.size() > 3)
|
||||
{
|
||||
for(NotificationChannel c : channels)
|
||||
nm.deleteNotificationChannel(c.getId());
|
||||
}
|
||||
|
||||
NotificationChannel channel = findExistingChannel(channels, channelId);
|
||||
|
||||
if(channel == null)
|
||||
{
|
||||
switch (channelId)
|
||||
{
|
||||
case AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE:
|
||||
channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE, AutomationService.NOTIFICATION_CHANNEL_NAME_SERVICE, NotificationManager.IMPORTANCE_LOW);
|
||||
break;
|
||||
case AutomationService.NOTIFICATION_CHANNEL_ID_FUNCTIONALITY:
|
||||
channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_FUNCTIONALITY, AutomationService.NOTIFICATION_CHANNEL_NAME_FUNCTIONALITY, NotificationManager.IMPORTANCE_HIGH);
|
||||
break;
|
||||
case AutomationService.NOTIFICATION_CHANNEL_ID_RULES:
|
||||
channel = new NotificationChannel(AutomationService.NOTIFICATION_CHANNEL_ID_RULES, AutomationService.NOTIFICATION_CHANNEL_NAME_RULES, NotificationManager.IMPORTANCE_HIGH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
static void createDismissibleNotificationSdk26(String title, String textToDisplay, int notificationId, boolean vibrate, String notificationChannelId, PendingIntent pendingIntent)
|
||||
{
|
||||
NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
@ -971,21 +1005,30 @@ public class Miscellaneous extends Service
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
{
|
||||
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Functionality warnings", NotificationManager.IMPORTANCE_HIGH);
|
||||
// chan.setLightColor(Color.BLUE);
|
||||
chan.enableVibration(false);
|
||||
// chan.setSound(null, null);
|
||||
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
mNotificationManager.createNotificationChannel(chan);
|
||||
NotificationChannel notificationChannel = getNotificationChannel(notificationChannelId);
|
||||
// notificationChannel.setLightColor(Color.BLUE);
|
||||
notificationChannel.enableVibration(vibrate);
|
||||
try
|
||||
{
|
||||
Uri notificationSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
// Uri notificationSound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE+ "://" +mContext.getPackageName()+"/"+R.raw.apple_ring));
|
||||
// Ringtone r = RingtoneManager.getRingtone(Miscellaneous.getAnyContext(), notification);
|
||||
AudioAttributes.Builder b = new AudioAttributes.Builder();
|
||||
b.setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN);
|
||||
notificationChannel.setSound(notificationSound, b.build());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "Notification", Log.getStackTraceString(e), 2);
|
||||
}
|
||||
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
mNotificationManager.createNotificationChannel(notificationChannel);
|
||||
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID);
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance(), notificationChannel.getId());
|
||||
}
|
||||
else
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance());
|
||||
|
||||
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
// builder.setCategory(Notification.CATEGORY_SERVICE);
|
||||
|
||||
builder.setWhen(System.currentTimeMillis());
|
||||
builder.setContentIntent(pendingIntent);
|
||||
|
||||
@ -996,8 +1039,10 @@ public class Miscellaneous extends Service
|
||||
|
||||
builder.setOnlyAlertOnce(true);
|
||||
|
||||
if(Settings.showIconWhenServiceIsRunning)
|
||||
if(Settings.showIconWhenServiceIsRunning && notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE))
|
||||
builder.setSmallIcon(R.drawable.ic_launcher);
|
||||
else if(!notificationChannelId.equals(AutomationService.NOTIFICATION_CHANNEL_ID_SERVICE))
|
||||
builder.setSmallIcon(R.drawable.info);
|
||||
|
||||
builder.setContentText(textToDisplay);
|
||||
builder.setStyle(new NotificationCompat.BigTextStyle().bigText(textToDisplay));
|
||||
@ -1005,7 +1050,6 @@ public class Miscellaneous extends Service
|
||||
NotificationManager notificationManager = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(1, builder.build());
|
||||
|
||||
|
||||
// Intent notifyIntent = new Intent(context, notification.class);
|
||||
// notifyIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
//
|
||||
@ -1027,7 +1071,7 @@ public class Miscellaneous extends Service
|
||||
// notificationManager.notify(1, notification);
|
||||
}
|
||||
|
||||
protected static NotificationCompat.Builder createDismissableNotificationBuilder(PendingIntent myPendingIntent)
|
||||
protected static NotificationCompat.Builder createDismissibleNotificationBuilder(boolean vibrate, String notificationChannelId, PendingIntent myPendingIntent)
|
||||
{
|
||||
NotificationManager mNotificationManager = (NotificationManager) AutomationService.getInstance().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
@ -1035,14 +1079,14 @@ public class Miscellaneous extends Service
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
{
|
||||
NotificationChannel chan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_HIGH);
|
||||
// chan.setLightColor(Color.BLUE);
|
||||
// chan.enableVibration(false);
|
||||
// chan.setSound(null, null);
|
||||
chan.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
mNotificationManager.createNotificationChannel(chan);
|
||||
NotificationChannel notificationChannel = getNotificationChannel(notificationChannelId);
|
||||
// notificationChannel.setLightColor(Color.BLUE);
|
||||
notificationChannel.enableVibration(vibrate);
|
||||
// notificationChannel.setSound(null, null);
|
||||
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
mNotificationManager.createNotificationChannel(notificationChannel);
|
||||
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance(), NOTIFICATION_CHANNEL_ID);
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance(), notificationChannelId);
|
||||
}
|
||||
else
|
||||
builder = new NotificationCompat.Builder(AutomationService.getInstance());
|
||||
|
10
app/src/main/res/drawable/info.xml
Normal file
10
app/src/main/res/drawable/info.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
|
||||
</vector>
|
@ -57,40 +57,6 @@
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/icon" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etNotificationIcon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginBottom="@dimen/activity_vertical_margin">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/sound" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etNotificationSound"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<ImageView
|
||||
|
@ -57,7 +57,7 @@
|
||||
<string name="end">Ende</string>
|
||||
<string name="save">Speichern</string>
|
||||
<string name="urlToTrigger">URL, die ausgelöst werden soll:</string>
|
||||
<string name="urlLegend">Variablen:\nSie können die folgenden Variablen verwenden. Vor dem Auslösen werden sie mit dem entsprechenden Wert Ihres Geräts ersetzt. Die Klammern müssen in den Text mit aufgenommen werden.\n\n[uniqueid] - Die Unique ID Ihres Geräts\n[serialnr] - Die Seriennummer Ihres Geräts\n[latitude] - Ihr gegenwärtiger Breitengrad\n[longitude] - Ihr gegenwärtiger Längengrad\n[phonenr] - Nummer des letzten ein- oder ausgehenden Anrufs\n[d] - Tag des Monats, 2-stellig mit führender Null\n[m] - Monat als Zahl, mit führenden Nullen\n[Y] - Vierstellige Jahreszahl\n[h] - Stunde im 12-Stunden-Format, mit führenden Nullen\n[H] - Stunde im 24-Stunden-Format, mit führenden Nullen\n[i] - Minuten, mit führenden Nullen\n[s] - Sekunden, mit führenden Nullen\n[ms] - milliseconds\n[notificationTitle] - Titel der letzten Benachrichtigung\n[notificationText] - Text der letzten Benachrichtigung</string>
|
||||
<string name="urlLegend">Variablen:\nSie können die folgenden Variablen verwenden. Vor dem Auslösen werden sie mit dem entsprechenden Wert Ihres Geräts ersetzt. Die Klammern müssen in den Text mit aufgenommen werden.\n\n[uniqueid] - Die Unique ID Ihres Geräts\n[serialnr] - Die Seriennummer Ihres Geräts (< Android 9)\n[latitude] - Ihr gegenwärtiger Breitengrad\n[longitude] - Ihr gegenwärtiger Längengrad\n[phonenr] - Nummer des letzten ein- oder ausgehenden Anrufs\n[d] - Tag des Monats, 2-stellig mit führender Null\n[m] - Monat als Zahl, mit führenden Nullen\n[Y] - Vierstellige Jahreszahl\n[h] - Stunde im 12-Stunden-Format, mit führenden Nullen\n[H] - Stunde im 24-Stunden-Format, mit führenden Nullen\n[i] - Minuten, mit führenden Nullen\n[s] - Sekunden, mit führenden Nullen\n[ms] - milliseconds\n[notificationTitle] - Titel der letzten Benachrichtigung\n[notificationText] - Text der letzten Benachrichtigung</string>
|
||||
<string name="wifi">WLAN</string>
|
||||
<string name="activating">Aktiviere</string>
|
||||
<string name="deactivating">Deaktiviere</string>
|
||||
|
@ -358,7 +358,7 @@
|
||||
<string name="networkAccuracy">Red exactitud [m]</string>
|
||||
<string name="minimumTimeForLocationUpdates">Tiempo mínimo para cambio en milisegundos para actualizar posición</string>
|
||||
<string name="timeForUpdate">Tiempo para actualizar [milisegundos]</string>
|
||||
<string name="urlLegend">Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo. Incluya las paréntecis en su texto. [uniqueid] - el número único de su dispositivo [serialnr] - el número de serie de su dispositivo [latitude] - su latitud [longitude] - su longitud [phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante [d] - Dia del mes, 2 digitos con cero al comienzo [m] - número del mes, 2 digitos con cero al comienzo [Y] - Número del año, 4 digitos [h] - Hora, formato 12 horas con cero al comienzo [H] - Hora, formato 24 horas con cero al comienzo [i] - Minutos con cero al comienzo [s] - Segundos con cero al comienzo [ms] - milisegundos [notificationTitle] - Título de la última notificación [notificationText] - Texto de la última notificación</string>
|
||||
<string name="urlLegend">Variables: Puede usar esas variables. Mientras ejecuta van a sustituir con los valores correspondientes en su dispositivo. Incluya las paréntecis en su texto.\n\n[uniqueid] - el número único de su dispositivo\n[serialnr] - el número de serie de su dispositivo (< Android 9)\n[latitude] - su latitud\n[longitude] - su longitud\n[phonenr] - Ùltimo número de llamada realizada tanto de salida como entrante\n[d] - Dia del mes, 2 digitos con cero al comienzo\n[m] - número del mes, 2 digitos con cero al comienzo\n[Y] - Número del año, 4 digitos\n[h] - Hora, formato 12 horas con cero al comienzo\n[H] - Hora, formato 24 horas con cero al comienzo\n[i] - Minutos con cero al comienzo\n[s] - Segundos con cero al comienzo\n[ms] - milisegundos\n[notificationTitle] - Título de la última notificación\n[notificationText] - Texto de la última notificación</string>
|
||||
<string name="screenRotationAlreadyEnabled">Rotación del monitor todavia esta activado.</string>
|
||||
<string name="screenRotationAlreadyDisabled">Rotación del monitor todavia esta desactivado.</string>
|
||||
<string name="needLocationPermForWifiList">Se puede usar la lista de wifis conocidos para determinar los sitios en los cuales estuvo. Por eso el permiso de localización es necesario para cargar la lista de wifis. Si quiere elegir uno de la lista tiene que conceder el permiso. En caso contrario todavia puede introducir un nombre wifi manualmente.</string>
|
||||
|
@ -533,7 +533,7 @@
|
||||
<string name="tuesday">Martedì</string>
|
||||
<string name="unknownError">Errore indeterminato.</string>
|
||||
<string name="until">finchè</string>
|
||||
<string name="urlLegend">Variabili:\n È possibile utilizzare le seguenti variabili. All\'attivazione saranno sostituite con il valore corrispondente sul dispositivo. Includi le parentesi nel tuo testo.\n\n[uniqueid] - Il numero di serie del tuo dispositivo\n[serialnr] - Il serial number del tuo dispositivio\n[latitude] - La latitudine del tuo dispositivo\n[longitude] - La longitudine del tuo dispositivo\n[phonenr] - Numero dell\'ultima chiamata (entrante o uscente)\n[d] - Il giorno del mese, sempre 2 cifre\n[m] - Mese in formato numerico, sempre 2 cifre\n[Y] - L\’anno, sempre 4 cifre\n[h] - Ore in formato 12 ore, sempre 2 cifre con due punti\n[H] - Ore in formato 24 ore, sempre 2 cifre con due punti\n[i] - Minuti, sempre 2 cifre\n[s] - Secondi, sempre 2 cifre\n[ms] - millisecondi, sempre 3 cifre [notificationTitle] - titolo dell\'ultima notifica [notificationText] - testo dell\'ultima notifica</string>
|
||||
<string name="urlLegend">Variabili:\n È possibile utilizzare le seguenti variabili. All\'attivazione saranno sostituite con il valore corrispondente sul dispositivo. Includi le parentesi nel tuo testo.\n\n[uniqueid] - Il numero di serie del tuo dispositivo\n[serialnr] - Il serial number del tuo dispositivio (< Android 9)\n[latitude] - La latitudine del tuo dispositivo\n[longitude] - La longitudine del tuo dispositivo\n[phonenr] - Numero dell\'ultima chiamata (entrante o uscente)\n[d] - Il giorno del mese, sempre 2 cifre\n[m] - Mese in formato numerico, sempre 2 cifre\n[Y] - L\’anno, sempre 4 cifre\n[h] - Ore in formato 12 ore, sempre 2 cifre con due punti\n[H] - Ore in formato 24 ore, sempre 2 cifre con due punti\n[i] - Minuti, sempre 2 cifre\n[s] - Secondi, sempre 2 cifre\n[ms] - millisecondi, sempre 3 cifre [notificationTitle] - titolo dell\'ultima notifica [notificationText] - testo dell\'ultima notifica</string>
|
||||
<string name="urlToTrigger">URL da caricare:</string>
|
||||
<string name="urlTooShort">L\'url deve avere almeno 10 caratteri.</string>
|
||||
<string name="usbTetheringFailForAboveGingerbread">Questo molto probabilmente non funzionerà dato che sei su una versione superiore ad Android 2.3. Tuttavia è possibile utilizzare la connessione wifi tethering per attivare la regola.</string>
|
||||
|
@ -56,7 +56,7 @@
|
||||
<string name="end">Einde</string>
|
||||
<string name="save">Opslaan</string>
|
||||
<string name="urlToTrigger">URL om te activeren:</string>
|
||||
<string name="urlLegend">Variabelen:U kunt de volgende variabelen gebruiken. Bij het triggeren zullen ze worden vervangen door de corresponderende waarde op je apparaat. Zet de haakjes in uw tekst. \n[uniqueid] - Het unieke id van uw apparaat[serienummer] - Het serienummer van uw apparaat[latitude] - De breedtegraad van uw apparaat[longitude] - De lengtegraad van uw apparaat[phonenr] - Nummer van het laatste inkomende of uitgaande gesprek[d] - Dag van de maand, 2 cijfers met voorloopnullen[m] - Numerieke weergave van een maand, met voorloopnullen[Y] - een volledige numerieke weergave van een jaar, 4 cijfers[h] - 12-uurs indeling van een uur, met voorloopnullen[H] - 24-uurs indeling van een uur, met voorloopnullen[i] - minuten, met voorloopnullen[s] - seconden, met voorloopnullen[ms] - milliseconden[notificationTitle] - titel van de laatste melding[notificationText] - tekst van de laatste melding</string>
|
||||
<string name="urlLegend">Variabelen:U kunt de volgende variabelen gebruiken. Bij het triggeren zullen ze worden vervangen door de corresponderende waarde op je apparaat. Zet de haakjes in uw tekst. \n[uniqueid] - Het unieke id van uw apparaat[serialnr] - Het serienummer van uw apparaat (< Android 9)[latitude] - De breedtegraad van uw apparaat[longitude] - De lengtegraad van uw apparaat[phonenr] - Nummer van het laatste inkomende of uitgaande gesprek[d] - Dag van de maand, 2 cijfers met voorloopnullen[m] - Numerieke weergave van een maand, met voorloopnullen[Y] - een volledige numerieke weergave van een jaar, 4 cijfers[h] - 12-uurs indeling van een uur, met voorloopnullen[H] - 24-uurs indeling van een uur, met voorloopnullen[i] - minuten, met voorloopnullen[s] - seconden, met voorloopnullen[ms] - milliseconden[notificationTitle] - titel van de laatste melding[notificationText] - tekst van de laatste melding</string>
|
||||
<string name="wifi">wifi</string>
|
||||
<string name="activating">Activeren</string>
|
||||
<string name="deactivating">Deactiveren</string>
|
||||
|
@ -70,7 +70,7 @@
|
||||
<string name="end">End</string>
|
||||
<string name="save">Save</string>
|
||||
<string name="urlToTrigger">URL to trigger:</string>
|
||||
<string name="urlLegend">Variables:\nYou can use the following variables. Upon triggering they will be replaced with the corresponding value on your device. Include the brackets in your text.\n\n[uniqueid] - Your device\'s unique id\n[serialnr] - Your device\'s serial number\n[latitude] - Your device\'s latitude\n[longitude] - Your device\'s longitude\n[phonenr] - Number of last incoming or outgoing call\n[d] - Day of the month, 2 digits with leading zeros\n[m] - Numeric representation of a month, with leading zeros\n[Y] - A full numeric representation of a year, 4 digits\n[h] - 12-hour format of an hour with leading zeros\n[H] - 24-hour format of an hour with leading zeros\n[i] - Minutes with leading zeros\n[s] - Seconds, with leading zeros\n[ms] - milliseconds\n[notificationTitle] - title of last notification\n[notificationText] - text of last notification</string>
|
||||
<string name="urlLegend">Variables:\nYou can use the following variables. Upon triggering they will be replaced with the corresponding value on your device. Include the brackets in your text.\n\n[uniqueid] - Your device\'s unique id\n[serialnr] - Your device\'s serial number (< Android 9)\n[latitude] - Your device\'s latitude\n[longitude] - Your device\'s longitude\n[phonenr] - Number of last incoming or outgoing call\n[d] - Day of the month, 2 digits with leading zeros\n[m] - Numeric representation of a month, with leading zeros\n[Y] - A full numeric representation of a year, 4 digits\n[h] - 12-hour format of an hour with leading zeros\n[H] - 24-hour format of an hour with leading zeros\n[i] - Minutes with leading zeros\n[s] - Seconds, with leading zeros\n[ms] - milliseconds\n[notificationTitle] - title of last notification\n[notificationText] - text of last notification</string>
|
||||
<string name="wifi">wifi</string>
|
||||
<string name="activating">Activating</string>
|
||||
<string name="deactivating">Deactivating</string>
|
||||
|
Reference in New Issue
Block a user