Created
September 20, 2016 05:45
-
-
Save jsaund/db6ce93f4571256ab3dafc76ac991d5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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