问题
I have an android application. I want to hide app icon from launcher screen & make it visible again after dialing some no i.e "1234" . Any helpful code snippet will be appreciated.
回答1:
Have a look on this link. May be it will help you
hidden App
Edit 1:
First:
PackageManager p = getPackageManager();
p.setComponentEnabledSetting(getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
Second :
public class DialBroad extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
if ((phoneNumber).equals("123456")) {
Intent appIntent = new Intent(context, MainActivity.class);
appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(appIntent);
setResultData(null);
} else {
// Toast.makeText(context, phoneNumber, Toast.LENGTH_LONG).show();
}
}
}
来源:https://stackoverflow.com/questions/21954317/hide-application-icon-from-launcher