SetEventLatestInfo does not work when the project goal is raised

0

The Notification_quote.java file works fine when the project target is under 13. The Sdk target is no longer 26. But it gives an error. and could not run. I'm sending Notification_quote.java in the attachment. I'd appreciate it if you could help me run this. Thanks. I'm just learning coding. Someone who can tell me how to update will save me from a big problem. :)

public Notification_Quote()
{
    getQuote = null;
}

private boolean isServiceRunning(String s, Context context)
{
    boolean flag1 = false;
    Iterator iterator = ((ActivityManager)context.getSystemService("activity")).getRunningAppProcesses().iterator();
    do
    {
        do
        {
            if (!iterator.hasNext())
            {
                return flag1;
            }
        } while (!((android.app.ActivityManager.RunningAppProcessInfo)iterator.next()).processName.equals(s));
        flag1 = true;
    } while (true);
}

public void onReceive(Context context, Intent intent1)
{
    l_time = Long.valueOf(PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()).getLong("calendar_value", 0L));
    DatabaseHelper databasehelper = new DatabaseHelper(context);
    helper = databasehelper;
    helper.createDatabase();
    helper.openDataBase();
    getQuote = helper.getRandomQuote(1, "");
    if (getQuote != null)
    {
        getQuote.moveToFirst();
        do
        {
            Quote_id = getQuote.getInt(0);
            Quotename = getQuote.getString(1).toString();
        } while (getQuote.moveToNext());
    }
    getQuote.close();
    String s;
    String s1;
    Intent intent2;
    PendingIntent pendingintent;
    Notification notification;
    Editor editor;
    try
    {
        helper.close();
    }
    catch (NullPointerException nullpointerexception5)
    {
        if (nullpointerexception5.getMessage() != null)
        {
            Log.e("null pointer ERROR", nullpointerexception5.getMessage());
        }
    }
    catch (Exception exception6)
    {
        if (exception6.getMessage() != null)
        {
            Log.e("ERROR", exception6.getMessage());
        }
    }
    nm = (NotificationManager)context.getSystemService("notification");
    s = context.getString(R.string.app_name);
    s1 = Quotename;
    intent2 = new Intent(context, Single_Quote.class);
    intent2.putExtra((new StringBuilder(String.valueOf(context.getPackageName()))).append(".quote_day").toString(), 2);
    if (isServiceRunning(context.getPackageName(), context))
    {
        flag = 0x4000000;
    } else
    {
        flag = 0x10000000;
    }
    pendingintent = PendingIntent.getActivity(context, 0, intent2, 0);
    notification = new Notification(R.drawable.ic_launcher, s1, System.currentTimeMillis());
    notification.setLatestEventInfo(context, s, s1, pendingintent);
    notification.vibrate = (new long[] {
        100L, 250L, 100L, 500L
    });
    notification.flags = 0x19 | notification.flags;
    editor = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()).edit();
    editor.putInt("Qid", Quote_id);
    editor.commit();
    nm.notify(1, notification);
    return;

}

}

android
notifications
alarmmanager
asked on Stack Overflow Apr 5, 2019 by Tolga AÇIKGÖZ • edited Apr 5, 2019 by MD Naseem Ashraf

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0