有没有在机器人上安装的事件吗?
问题描述:
有没有一些事件/接收器或东西安装后或安装后直接处理第一次执行?或者我需要用preferences效仿?
Is there some event/receiver or something for handling first execution after installation or directly after installation? Or Do I need it emulate with preferences?
答
还有就是ACTION_PACKAGE_ADDED$c$c>广播意图,但正在安装的应用程序不会收到此。
There is the ACTION_PACKAGE_ADDED
Broadcast Intent, but the application being installed doesn't receive this.
因此,如果preference设置检查可能是最简单的解决方案。
So checking if a preference is set is probably the easiest solution.
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
boolean firstRun = p.getBoolean(PREFERENCE_FIRST_RUN, true);
p.edit().putBoolean(PREFERENCE_FIRST_RUN, false).commit();