List of usage examples for android.content.pm ChangedPackages getPackageNames
public @NonNull List<String> getPackageNames()
From source file:com.commonsware.android.sawmonitor.SAWDetector.java
@TargetApi(Build.VERSION_CODES.O) static void seeSAW(Context ctxt) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctxt); int sequence = prefs.getInt(PREF_SEQUENCE, 0); PackageManager pm = ctxt.getPackageManager(); ChangedPackages delta = pm.getChangedPackages(sequence); if (delta != null) { prefs.edit().putInt(PREF_SEQUENCE, delta.getSequenceNumber()).apply(); if (sequence > 0) { String msg = ctxt.getString(R.string.msg_something); for (String pkg : delta.getPackageNames()) { SAWDetector.seeSAW(ctxt, pkg, msg); }/* w w w. ja v a 2 s .c o m*/ } } }