AWS – utilizing VPC peering connection to connect different account RDS

A scenario is that my friend and I have two AWS free tier.
My friend want to connect to my RDS through private IP instead of public IP.
Because we think the speed and security will be better.
Let RDS be public sounds not like a good idea!

繼續閱讀 “AWS – utilizing VPC peering connection to connect different account RDS”

Android – AlarmManager 背景定時啟動

最近寫App有用到AlarmManager定時啟動一個IntentService跟Server拉資料,來筆記一下。

Google 官方範例程式,很簡單的幾個java程式,分別為SampleAlarmReceiver, SampleSchedulingService, SampleBootReceiver。

首先SampleAlarmReceiver主要就是跟系統註冊一個定時發廣播的Intent到SampleAlarmReceiver的Receiver,接到之後再去啟動SampleSchedulingService這個Intent Service 做自己想做的事。

另外SampleBootReceiver是主要當手機重開機之後,AlarmManager註冊的事件都會被清除,所以當重開機後要重新註冊事件。

記得Androidmanifest 要加入請求權限。
詳細可以參考 :Google Scheduling Repeating Alarms 官方教學
Sample code 就在旁邊的 Try it out!動手玩一下可以很快理解!