Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void AlarmOtherLocation(Context mContext, String type, LatLng latLng)
- {
- AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
- Random random = new Random();
- int expireCode = random.nextInt(9999 - 1000) + 1000;
- Log.e("AlarmLocation","AlarmOtherLocation_code>>>"+expireCode);
- ArrayList<LatLngType> arrayList_ = (ArrayList<LatLngType>) Utils.getLocation2(mContext);
- arrayList_.get(0).setAlarmID(expireCode);
- Utils.setLocation2(mContext,arrayList_);
- //30.705318852820483,76.7069748044014
- double longitude = latLng.latitude;
- double latitude = latLng.longitude;
- Intent notificationIntent = new Intent("android.media.action.DISPLAY_NOTIFICATION_AlarmReceiverLocation01001");
- notificationIntent.setClass(mContext, AlarmReceiverLocation.class);
- notificationIntent.addCategory("android.intent.category.DEFAULT");
- notificationIntent.putExtra("type", type);
- notificationIntent.putExtra("locationType", "other");
- notificationIntent.putExtra("savedLat", longitude);
- notificationIntent.putExtra("savedLng", latitude);
- notificationIntent.putExtra("expireCode", expireCode);
- //notificationIntent.putExtra("DATA",abc);
- PendingIntent broadcast = PendingIntent.getBroadcast(mContext, expireCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
- ////////////////////////////////////////////////////
- Calendar calendar = Calendar.getInstance();
- Calendar now = Calendar.getInstance();
- calendar.set(Calendar.HOUR_OF_DAY, 11);
- calendar.set(Calendar.MINUTE, 0);
- calendar.set(Calendar.SECOND, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- try
- {
- Log.e("AlarmLocation","AlarmOtherLocation_code222>>>");
- alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
- 300000L, broadcast);
- }
- catch (Exception e)
- {
- Log.e("AlarmLocation","AlarmWorkLocation_code_ex>>>"+e);
- }
- }
Add Comment
Please, Sign In to add comment