I started activity of service and I am using the following code: This application is used to unlock the service only phone works fine when set against the backdrop but when the app is closed, but do not start my activity. Anyone of you think how to get the required functionality is OT thanks in advance! Edit to> problem becomes unlocked phone anywhere on the first event in step unlocking but activity does not start. The second event is unlocked if the phone activity has been unlocked. < Get code> Kigard Manager Km = (Keygard Manager) System System (Reference. KEYGUARD_SERVICE); The Last Kigard Manager Kegard Lock K.L. = Km Newcastord Lock ("Mikegold Lock"); Kl.disableKeyguard (); PowerManager pm = (PowerManager) getSystemService (event.pOWER_SERVICE); Wakelok Wakelok = Pmknevvklok (Povermnagrkful_vek_lok | PowerManager.akwayr_coses_wakeup | PowerManagerkon_aftr_riliz, "Mywakelok"); WakeLock.acquire (); Intent i = new intent (this, some activity class); Ikaddflags (Indomnagrklayoutpramskflag_so_when_lokd + Indomnagrklayoutpramskflag_dismis_keyguard + Indomnagrklayoutpramskflag_keep_skrin_on + Indomnagrklayoutpramskflag_trn_skrin_on); I.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP); I.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); I.addCategory (Intent.CATEGORY_LAUNCHER); I.putExtra ("name", name); StartActivity (i);
Use this code it will help you. // More Explanations First of all, if your application is not running, then this code should be called Then use this code
intent = new intent (reference, main activity category); I.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); Context.startActivity (i);
Intent I = new intent (reference, MainActivity.class). I.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); Context.startActivity (i);
intent = new intent (reference, MainActivity.class); Context.startActivity (i);
Comments
Post a Comment