android - Finish activity before it starts? -


I have registered my activity to handle ACTION_DIAL intent but in some cases I basically want to ignore intentions. In OnCreate, I am checking SharedPreferences for a Boole which means that the user has a dial-up feature, if not I call the Finnish () and then return; But it still appears to open a window and then turns off, how can I avoid it?

  Creating a protected void (bundle saved instainstate) {super.onCreate (savedInstanceState); Shared References prefs = PreferenceManager.getDefaultSharedPreferences (this); Boolean headlined = prefs.getBoolean (preferences.hAS_DIALER, incorrect); // Check whether the ACTION_DIAL intent was launched to bring the user to string number = getIntent (). GetDataString (); If (! TextUtils.isEmpty (number)) {if (forDialer) {launchDialer = true; } Else {finish (); Return; }}}  

You can register ACTION_DIAL in one The broadcast receiver (directly in the manifest) or in the service (now it depends on what you are planning to do) and there is the same logic in it. If you need you can start activities from there.


Comments