Skip to content

Instantly share code, notes, and snippets.

@scottyab
Created May 14, 2014 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottyab/d5ab6a284622ebc46d5a to your computer and use it in GitHub Desktop.
Save scottyab/d5ab6a284622ebc46d5a to your computer and use it in GitHub Desktop.
Creating an explicit pending intent is safer than implicit
//explicit (to MyService)
Intent intent = new Intent(context, MyService.class);
PendingIntent pi = PendingIntent.getService(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
//implicit
Intent intent = new Intent("com.my.app.action")
PendingIntent pi = PendingIntent.getService(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment