Служба Foreground не работает в LG K10 2017 Android 7.0 Device - PullRequest
0 голосов
/ 10 мая 2018

Привет, у меня есть Android-приложение, которое должно запустить службу Foreground, и оно отлично работает на устройствах Huawei, Sony и Samsung ... на устройстве LG K10 2017 android 7.0 служба не запускается !! уведомление не отображается, пожалуйста, дайте мне знать, если у кого-то есть аналогичная проблема или есть какие-либо идеи по ее решению. Спасибо

   public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
    {
        //   if (shared.Readbool("work_in_bg"))
        RegisterForegroundService();
        Thread thread = new Thread(new ThreadStart(request_new_orders));
        thread.Start();
        background_active = true;
        return StartCommandResult.Sticky;
    }

 void RegisterForegroundService()
    {
        ongoing = new Notification(Resource.Drawable.SmartDeliveryAppIcon, "Smart Delivery");
        Intent intent = new Intent(this, typeof(MainActivity));
        intent.SetFlags(ActivityFlags.SingleTop| ActivityFlags.ClearTop);
        pendingIntent = PendingIntent.GetActivity(this, 56, intent, 0);
        ongoing.SetLatestEventInfo(this, "Smart Delivery", "waiting ....", pendingIntent);
        StartForeground((int)NotificationFlags.ForegroundService, ongoing);
    }
...