broadcastreceiver

CONNECTIVITY_CHANGE deprecated in target of Android N

可紊 提交于 2019-12-06 17:23:58
问题 I am getting warning of deprecated declaration of Broadcast Receiver. <!-- NETWORK RECEIVER... --> <receiver android:name=".utils.NetworkUtils" > <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> </receiver> WARNING: Declaring a broadcastreceiver for android.net.conn.CONNECTIVITY_CHANGE is deprecated for apps targeting N and higher. In general, apps should not rely on this broadcast and instead use JobScheduler or GCMNetworkManager. Is there any

Weird “Receiver not registered” exception

北慕城南 提交于 2019-12-06 16:43:26
问题 In onResume() I do: registerReceiver(timeTickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK)); and in onPause(): unregisterReceiver(timeTickReceiver); I see "java.lang.IllegalArgumentException: Receiver not registered" reports in Android Developer Console (there are only 2 reports and my app has thousands of users). The exception is triggered by unregisterReceiver(). What can be happening? I don't feel very confident to just surround it with try-catch. 回答1: We've seen this error when

BroadcastReceiver for Package_Install not working

回眸只為那壹抹淺笑 提交于 2019-12-06 16:27:41
@Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Toast.makeText(context, "Package Received", Toast.LENGTH_SHORT).show(); Log.d("Package Installing", "Package Installing"); String action=intent.getAction(); if(action.equals(intent.ACTION_PACKAGE_INSTALL)) { Toast.makeText(context, "Package Added", Toast.LENGTH_SHORT).show(); Log.d("Package INstalling", "Package Installed"); } } //My Manifest File: <receiver android:name="com.example.anotherbroadcastreceiverexample.MyReceiver" android:enabled="true"> <intent-filter><action android:name="android

BroadCastReceiver for Multiple sent Messages?

霸气de小男生 提交于 2019-12-06 16:09:21
问题 In my app i am sending multiple sms at one time which working perfectly fine. But when i am trying to receive confirmation messages in Broadcast Receiver i am expecting to get all numbers but i end up in receiving same one number instead of n numbers. To send SMS Intent intent = new Intent(SENT); intent.putExtra("phonenumber", sms_phonenumber); PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); SmsManager sms_man = SmsManager.getDefault();

Ongoing Notification Disappears When Clearing Memory

空扰寡人 提交于 2019-12-06 16:01:32
My problem is I want to cancel an ongoing notification only if cancel option is selected in the app, but whenever I clear memory on "Task Manager/RAM" tab of my android device my notification disappears. What can I do to make my ongoing notification stay even if I clear memory? I created an ongoing notification in a class that extends BroadcastReciever class.In my OnGoingNotificationReciever(extends BroadcastReciever): Intent mainAct = new Intent(context, MainActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(context, 555, mainAct, PendingIntent.FLAG_UPDATE_CURRENT);

AlarmManager is not working after app is closed? - Android

拟墨画扇 提交于 2019-12-06 15:41:15
I have a small problem about alarmmanager but I couldn't find a answer which fits to my code. My question is simple. I have a list of alarms which is set to future. While my app is running, I can recieve Notification. But when I close my app, It doesn't send notification to me and if I run my app again, past notifications can be seen in notification center. Here is my codes. In MainActivity.java I use this method which can take a Person List and sets alarm of each of Person. I run this method in onCreate() private void createScheduledNotification(List<Person> people) { for(int i = 0; i<people

Cordova #Intent-BroadcastReceiver

柔情痞子 提交于 2019-12-06 15:05:38
First of all, I'm working with some specific API ( Grand Stream GXV3275 phone ) which requires that Intent - BroadcastReceiver combo breaker. When my device is on landscape orientation it works good so the problem came with Intent - BroadcastReceiver. So I need that IntentFilter to know my HOOKEVENT ans then receive it with that BroadcastReceiver. I just want to know why it doesn't even show the alert or don't work at all. Is that possible to deal with IntentFilter on CordovaPlugin? With BroadcastReceiver? I made some test on my CordovaActivity and HOOKEVENT ; updating a text-view. So I assume

BroadcastReceiver for Screen On/Off in ANDROID When App is not running

梦想与她 提交于 2019-12-06 14:57:31
问题 I want to detect screen off and on event for that i have created BroadcastReceiver, It only works fine when app is running and when i remove the app from task manager then it does not works. Activity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try{ BroadcastReceiver myrcver = new BootReceiver(); IntentFilter screenStateFilter = new IntentFilter(); screenStateFilter.addAction(Intent.ACTION_SCREEN_ON

“TooManyMessages” Error coming from c2dm.intent.RECEIVE Intent

江枫思渺然 提交于 2019-12-06 14:50:20
问题 Does anyone have any documentation on this "TooManyMessages" error . After I call the GoogleCloudMessaging send method I am getting an intent from com.google.android.c2dm.intent.RECEIVE with the following key/value pairs in the extras bundle. Send error: Bundle[{error=TooManyMessages, message_type=send_error, google.message_id=1, android.support.content.wakelockid=1} 回答1: This means that too many messages were stored in the GCM server for a single device without being delivered (which might

AsyncTask in BroadcastReceiver in Android gives sending message to a Handler on a dead thread error

烂漫一生 提交于 2019-12-06 14:39:54
I have implemented Push Notification in my appliction. Once the push message is received I call a webservice with the help of AsyncTask. This works fine when the application is being used or is in the memory. But if I stop the application from settings and then if the message is pushed to the device, there is an exception such as "sending message to a Handler on a dead thread". This is probably since the app is not live. Can someone let me know if its alright to actually remove AsyncTask from push notification receiver and just handle the message? Regards Sunil IMO AsyncTask should be only