Alarm with Broadcast not working in my android compose application

Viewed 124

I have a android compose application and broadcast not working with alarm.

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<receiver android:name=".broadcast.EventAlarmBroadcastReceiver"
        android:exported="false"
        android:process=":remote"
        android:enabled="true">
        <intent-filter>
            <action android:name="com.zxy.control_time.app.REMIND_ACTION"/>
        </intent-filter>        
</receiver>

kotlin code , setExact function is not working

val intent = Intent(context,EventAlarmBroadcastReceiver::class.java)
intent.`package` = BuildConfig.APPLICATION_ID
val pendingIntent = PendingIntent.getService(
        context,
        EventAlarmBroadcastReceiver.REMIND_INTENT_ID_BASIC_NUMBER + this.id,
        intent,
        0
    )
// alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP,System.currentTimeMillis() + 5 * 1000,pendingIntent) not working
// context.sendBroadcast(intent) working fine
0 Answers
Related