-
Notifications
You must be signed in to change notification settings - Fork 16
Fail to build running this app in flutter. #14
Comments
I find a solution by searching the Solution is change |
Hey there! Thanks for letting me know! I will see if I can make use of the API suggested in the deprecation notice and comment on the original issue the file was taken from 👍 |
Use |
Good to know, thanks! |
Hi Minseong,
I downloaded your BedTime app and looks like you somehow managed to run app from background service. Moreover, |
Hi @KodPlanet I'm using the Here is the code that I used. AlarmBroadcastReceiver.java// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package io.flutter.plugins.androidalarmmanager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.content.pm.PackageManager;
import android.view.WindowManager;
public class AlarmBroadcastReceiver extends BroadcastReceiver {
private static PowerManager.WakeLock wakeLock;
@Override
public void onReceive(Context context, Intent intent) {
PowerManager powerManager = (PowerManager)
context.getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
PowerManager.ACQUIRE_CAUSES_WAKEUP |
PowerManager.ON_AFTER_RELEASE, "My wakelock");
Intent startIntent = context
.getPackageManager()
.getLaunchIntentForPackage(context.getPackageName());
startIntent.setFlags(
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |
Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
);
wakeLock.acquire();
context.startActivity(startIntent);
AlarmService.enqueueAlarmProcessing(context, intent);
wakeLock.release();
}
} There is a need for permissions (#18) to fire the alarm from the background. And I'm using geisterfurz007's alarm app system.
I had a hard time building an alarm system with Flutter. I hope this helps you. |
I want to make alarm app that is my first app, so I would like to refer to your application.
But build failed..
I've changed the
AlarmBroadcastReceiver.java
.The error code is here.
How to debug this error?
The text was updated successfully, but these errors were encountered: