16

I'm creating a custom launcher that is used like a kiosk mode for the phone. This means most things are hidden away but allows the user to access some apps. I've noticed that when I launch apps from the Recent Apps list, when I press the back button, the stock launcher comes up instead of my custom launcher. I made sure my custom launcher is the default launcher since that's the launcher that comes up when I press the home button. Has anyone run into this issue? How do I solve it?

Huy T
  • 1,123
  • 1
  • 10
  • 20

2 Answers2

0

In my attempt to make a Custom Launcher myself, to make that result you needed to disable the default launcher, that i was able to do using KeyguardManager.

package com.themejunky.locker.services;


public class KeyguardService extends Service {

    BroadcastReceiver mReceiver, mBatteryReceiver;

// Intent myIntent;
public class LocalBinder extends Binder {
    public KeyguardService getService() {
        return KeyguardService.this;
    }
}

@Override
public IBinder onBind(Intent intent) {
    return mBinder;
}

private final IBinder mBinder = new LocalBinder();

@Override
public void onCreate() {
    KeyguardManager.KeyguardLock k1;

    KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
    k1 = km.newKeyguardLock("IN");
    k1.disableKeyguard();

    KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
    KeyguardManager.KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
    lock.disableKeyguard();

    IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
    filter.addAction(Intent.ACTION_SCREEN_OFF);
    filter.setPriority(999);

    mReceiver = new LockScreenReceiver();
    registerReceiver(mReceiver, filter);

    mBatteryReceiver = new BatteryReceiver();
    IntentFilter filter2 = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
    filter2.addAction(Intent.ACTION_BATTERY_OKAY);
    filter2.addAction(Intent.ACTION_BATTERY_LOW);
    registerReceiver(mBatteryReceiver, filter2);

    super.onCreate();
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    return START_STICKY;
}

@Override
public void onDestroy() {
    unregisterReceiver(mReceiver);
    unregisterReceiver(mBatteryReceiver);
    super.onDestroy();
}

}

Tazz
  • 711
  • 1
  • 7
  • 23
-1

The only solution i found when i had this same problem was restarting the device. When you launch apps from the recent apps after that and press the back button you will see the correct home screen.

Mario N
  • 1
  • 1