alarmmanager

[RK3288][Android6.0] 调试笔记 --- WiFi一直处于“正在连接”状态

匿名 (未验证) 提交于 2019-12-03 00:26:01
Platform: RK3288 OS: Android 6.0 Kernel: 3.10.92 Wifi提示正在连接,但是一直连接不上。 换了其他的一个AP,也提示连接不上。 根据WIFI连接过程可知,显示正在连接时dhcp client会从路由器那边获取ip address. 06-13 14:56:23.697 583 1340 D DhcpClient: Broadcasting DHCPDISCOVER 06-13 14:56:23.710 583 1402 D DhcpClient: Received packet: b0:f1:ec:49:50:7c OFFER, ip /10.89.19.43, mask /255.255.255.0, DNS servers: /61.177.7.1 , gateways [/10.89.19.254] lease time 28361, domain null 06-13 14:56:23.756 583 1340 D DhcpClient: Got pending lease: IP address 10.89.19.43/24 Gateway 10.89.19.254 DNS servers: [ 61.177.7.1 ] Domains DHCP server /10.89.19.254 Vendor info null

AlarmManager alarm is called immediately when trigger time is in the past

放肆的年华 提交于 2019-12-02 23:29:49
问题 Below is the code I am using to create alarms when data is pulled from external API. If the time set is in the past, the alarm goes off as soon as it is set(2 second gap). For example if I set the alarm for 8:00 AM, 10th April at 10:00 AM on 11th April(Past time). It starts the alarm as soon as it is set. public static final int ALARM_REQUEST_CODE = 1001; public static AlarmManager alarmManager = (AlarmManager) EHCApplication.getInstance().getApplicationContext().getSystemService(Context

Cant get AlarmManager and Multiple Notifications to work

牧云@^-^@ 提交于 2019-12-02 22:56:53
问题 Ok.. I'm trying to figure out three problems. I am unable to make AlarmManager notify me I want to display a different message for each notifier I will be glad if anyone can help me out, I'm not posting this here just so I can get the code, I have been at it for 2 days so I thought I'd ask the experts here. If I can find someone who would check the below code, show my wrongs and point me in the direction to rectify those wrongs.. Thank yhu. Here is my Notifier class where I set the days and

How Google calendar or Instagram make their apps all the time up and running even after force stop

[亡魂溺海] 提交于 2019-12-02 22:37:15
Looks like force stop should prevent app from running and it's even disable all app's alarms. However I found that notification in Google Calendar still shown fine even after force stop, and I all the time see Instagram app running, even when I kill it, it's just restart automatically and it's once again there. So, what is a way to make app running constantly? I'm doing app with reminders and need to show notifications in specific time, regardless how app was previously closed before. If you start a service in Application Class than your service will be always running even though if a user

Android AlarmManager fire at wrong time

孤街浪徒 提交于 2019-12-02 22:31:01
问题 My app will set an AlarmManager to fire some event and repeat it on 12:00pm everyday. However, my clients report that the alarm sometimes wake up normally, but sometimes wake up at other time (eg. 10/11pm). Here is the code snippet: Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); if (calendar.get(Calendar.HOUR_OF_DAY) >= 12 && calendar.get(Calendar.MINUTE) > 0) { calendar.add(Calendar.DAY_OF_MONTH, 1); } calendar.set(Calendar.HOUR, 0);

Android 轮询最佳实践 Service + AlarmManager+Thread

一曲冷凌霜 提交于 2019-12-02 21:39:30
android中涉及到将服务器中数据变化信息通知用户一般有两种办法, 推送 和 轮询 。 消息推送是服务端主动发消息给客户端,因为第一时间知道数据发生变化的是服务器自己,所以推送的优势是实时性高。但服务器主动推送需要单独开发一套能让客户端持久连接的服务端程序,不过现在已经有很多开源的代码实现了基于xmmp协议的推送方案,而且还可以使用谷歌的推送方案。但有些情况下并不需要服务端主动推送,而是在一定的时间间隔内客户端主动发起查询。 譬如有这样一个app,实时性要求不高,每天只要能获取10次最新数据就能满足要求了,这种情况显然轮询更适合一些,推送显得太浪费,而且更耗电。 但是不管是轮询还是推送都需要 无论应用程序是否正在运行或者关闭 的情况下能给用户发送通知,因此都需要用到service。我们有两种方案来使用service达到此目的: 方案一:service + Thread 在service中开启一个带有while循环的线程,使其不断的从服务器查询数据(一定时间间隔内),当发现有需要通知用户的情况下发送notification。这种方案的代码大致是: import org.apache.http.Header; import org.json.JSONObject; import android.app.Notification; import android.app

Android: open activity when alarm clock is done or dismmised

自古美人都是妖i 提交于 2019-12-02 20:52:59
问题 Every alarm clock that the user set through the phone stock clock has an option of opening another application when the alarm is dismissed or done (I'm not sure if this feature is added in Marshmallow but I have it and I run android M). The default for each alarm is "none" but you're able to pick the mail, weather, music applications etc... I would like to add my application to this list so it'll open directly when the alarm is done. What settings are needed for my application to show up at

Context Cannot be Resolved

喜夏-厌秋 提交于 2019-12-02 19:01:48
问题 I'm attempting to use a method to schedule monthly alarms described here: How to implement yearly and monthly repeating alarms? However I'm getting two errors on the lines: AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); and PendingIntent sender = PendingIntent.getBroadcast(context, stating "context cannot be resolved" and "context cannot be resolved to a variable" ...any suggestions on how this can be resolved? public class Alarm extends Service { // compat

Auto Logout of App when in Background

点点圈 提交于 2019-12-02 17:05:33
问题 I Have created an app which will log out within 1 Min; when it is running in the background, by employing Alarm Mgr method. However, when I debug and run in on Android based device, nothing happens. I have run some basic diagnostic test and found out that BaseActivity is not being logged in the Logcat. public class BaseActivity extends Activity{ BaseActivity context; private AlarmManager alarmMgr; //TO CALL OUT THE CLASS OF THE ALARM SERVICE private PendingIntent alarmIntent; // FOR TARGET

Why dose notification raise while setting time of notification?

你。 提交于 2019-12-02 15:21:54
问题 I have used time picker to set the time of notification by user. I have used alarm manager and notification builder. I have called the setAlarm method on clickListener of a button to save data. So when this setAlarm method gets called Notification raises at the same time as well as it raises at the time user have set. I don't want it to be raised when I save the data. Can anyone tell why this is happening? setAlarm method @SuppressLint("NewApi") private void setAlarm(Calendar targetmCalen) {