嘿,无论如何在用户第一次打开应用程序后每 15 天发送一次通知吗?提前致谢
您可以保存使用的应用程序第一次运行的日期SharedPreferences
中OnCreate
的MainActivity.java的。
然后你可以使用日历对象来获得这样的一天
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
int start = sharedPref.getInt("firstRunDate", 0);
Calender cal = Calendar.getInstance();
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)+1;
if((dayOfMonth+15)%30 == start)
//send notifications
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句