broadcastreceiver

Receiving broadcast error for Bluetooth discovery

試著忘記壹切 提交于 2019-12-08 04:55:35
问题 I am trying to find nearby Bluetooth devices so I'm using BroadcastReceiver. Most of the time it works fine but sometimes I get this error. 04-30 09:50:15.277: E/AndroidRuntime(847): FATAL EXCEPTION: main 04-30 09:50:15.277: E/AndroidRuntime(847): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.bluetooth.device.action.FOUND (has extras) } in com.waratah.app.SetMachineActivity$2@40582d20 04-30 09:50:15.277: E/AndroidRuntime(847): at android.app.LoadedApk

Pass data from broadcast receiver to activity

本小妞迷上赌 提交于 2019-12-08 04:52:59
问题 I have a broadcast receiver which is listening to the WifiManager.SCAN_RESULTS_AVAILABLE_ACTION. In that receiver I filter all the available networks and return a list of networks with a specific SSID. I nned to pass that list back to the MainActivity of my application. I know I can create an inner class for my Broadcast receiver but I prefer to create a separate class for better organization. I am thinking in creating a static variable in my mainActivity class and then set that value. Is

moveTaskToBack in onCreate causes activity to show briefly and then hide

北城以北 提交于 2019-12-08 04:32:34
问题 I have a BroadcastReceiver that receives a push notification, I then start an activity and show a notification. (notice that the activity is not started when the user actions the notification) My intention is to start the activity in "background mode" and then when the user responds to the notification bring the activity to the front. All is working perfectly except that the activity briefly shows and then immediately hides. (flashing activity for a second). Here is my code: BroadcastReceiver

Call service method from notification with BroadcastReceiver in Xamarin Android

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 03:30:48
问题 I start a service and create new thread (downloading a large file). At the same time I display a notification with action (pause button). When I press this button "WSTRZYMAJ" I want call PauseDownload() method from my service. How can I do this? I have read about BroadcastReceiver, create this class but how to call method from service from BroadcastReceiver class? Screen from notification: Fragment of my service: class DownloadsService : Service { DownloadsBroadcastReceiver receiver;

Listen to incoming multipart SMS message

百般思念 提交于 2019-12-08 03:15:26
问题 I can catch newly incoming SMS messages. But if that is a multipart message, my broadcast receiver receives all parts of the message at several times. Is there a way to receive the whole message at one time - like default messaging app does? 回答1: Holy...! After reading the Android source (this file), I realize that this is such a stupid question... Here is my receiver: @Override public void onReceive(Context context, Intent intent) { Log.d(ClassName, "received SMS"); Bundle bundle = intent

Listening and reciveing specific SMS message?

折月煮酒 提交于 2019-12-08 02:36:10
问题 Ok i Have this broadcast reciver for Listening incoming SMS public class SmsReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { //---get the SMS message passed in--- Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String str = ""; if (bundle != null) { //---retrieve the SMS message received--- Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for (int i=0; i<msgs.length; i++){ msgs[i] =

BroadCast Receiver Active only when activity is running else deactivated

我只是一个虾纸丫 提交于 2019-12-08 01:59:18
问题 Hi i am using a broadcast receiver for location listening but this broadcast receiver is working only when activity is in foreground else when i am not using this app then receiver is not active here is code of activity onCreate's method where i am registering my broadcast receiver PendingIntent proximityIntent = PendingIntent.getBroadcast(getApplicationContext(), i, intent, PendingIntent.FLAG_UPDATE_CURRENT); locationManager.addProximityAlert( latitude, // the latitude of the central point

How to bring application from background to foreground via BroadcastReceiver

狂风中的少年 提交于 2019-12-08 01:38:46
问题 I have two classes which are MainActivity and MyBroadcastReceiver. BroadcastReceiver detects whether phone screen is on or off. My desire is to launch my application whenever screen lock is released. I mean that I want to bring my application to the front when phone lock releases. Here is my activity class: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

Cordova #Intent-BroadcastReceiver

ぐ巨炮叔叔 提交于 2019-12-08 00:19:44
问题 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

AlarmManager is not working after app is closed? - Android

↘锁芯ラ 提交于 2019-12-07 23:44:33
问题 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