Skip to content

Instantly share code, notes, and snippets.

@jsaund
Created September 20, 2016 05:45
Show Gist options
  • Save jsaund/db6ce93f4571256ab3dafc76ac991d5c to your computer and use it in GitHub Desktop.
Save jsaund/db6ce93f4571256ab3dafc76ac991d5c to your computer and use it in GitHub Desktop.
public class MainActivity extends AppCompatActivity {
private static final String TAG = "Ping";
private Handler handler;
class PingHandler extends Handler {
@Override
public void handleMessage(Message msg) {
Log.d(TAG, "Ping message received");
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
handler = new PingHandler();
final Message msg = handler.obtainMessage();
handler.sendEmptyMessageDelayed(0, TimeUnit.MINUTES.toMillis(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment