Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Service extends android.app.Service {
- Handler h = new Handler();
- Runnable task = new Runnable() {
- @Override
- public void run() {
- ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
- List<ActivityManager.RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses();
- Log.d("tag", "chack!!!!!!!!!!!!!!!!");
- for (int i = 0; i < procInfos.size(); i++) {
- if (procInfos.get(i).processName.equals("com.mwdn.pricechecker")) {
- h.postDelayed(task, 20_000);
- return;
- }
- }
- Intent i = getPackageManager().getLaunchIntentForPackage("com.mwdn.pricechecker");
- startActivity(i);
- h.postDelayed(task, 20_000);
- }
- };
- @Nullable
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
- @Override
- public void onCreate() {
- super.onCreate();
- h.postDelayed(task, 10_000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement