Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1004168 // androidEnableRepeatingAlarm

JavaX fragment (include)

import android.app.*;
import android.content.*;
import android.os.SystemClock;

static void androidEnableRepeatingAlarm(int firstDelayMS, int repeatingDelayMS, S alarmSnippetID) ctex {
  Activity context = androidActivity();
  AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
  Class receiverClass = Class.forName("de.tinybrain.javax_allperms.AlarmManagerReceiver");
  Intent intent = new Intent(context, receiverClass);
  intent.putExtra("snippetID", str(parseSnippetID(alarmSnippetID)));
  PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, 0);
  //am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+firstDelayMS, repeatingDelayMS, pi);
  am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+firstDelayMS, repeatingDelayMS, pi); 
}

Author comment

Began life as a copy of #1004166

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004168
Snippet name: androidEnableRepeatingAlarm
Eternal ID of this version: #1004168/1
Text MD5: 1ad045e42d3c35f645000bc4f5d3ddd1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-05 14:11:18
Source code size: 842 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 545 / 523
Referenced in: [show references]