broadcastreceiver

What is the best way of create BroadcastReceiver?

烈酒焚心 提交于 2019-12-01 10:30:53
I have spent few days to work on Service + BroadcastReceiver, but still cannot make it perfect. I hope someone can help, thanks! I am writing a App that show user current location on map(The map that I wrote, not Google Map) and send out Notification alarm when user go inside a predefined zone. In my code. there are two main objects. A GPS service and Main Activity. The GPS service broadcast location when location changed. The Main Activity receive the latest location by BroadcastReceiver. I have done some researches on how to register BroadcastReceiver. There are two ways that I found: Method

Android - Broadcast Receiver not being fired

南笙酒味 提交于 2019-12-01 10:28:42
问题 I know this has been asked ALOT on here, but I have been scouring the interwebs for hours and I have even reused some of my previous code for receiving sms' and I got...nothing. So, here goes, basic app to receive SMS but the app never receives the intent. I thought the intent may be ignored if the text is sent from the same phone but that does not seem to be the case, as other apps pick up the text fine. Here is my manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android=

show a notification on a particular date and time

十年热恋 提交于 2019-12-01 10:22:10
问题 I need to show a notification on a particular date and time (27-06-2015 13:00). Initially I am showing a toast message. I have created a broadcast receiver to do that. I am calling the pending intent like this - Activity Code - Calendar cal=Calendar.getInstance(); cal.set(Calendar.MONTH,(5)); cal.set(Calendar.YEAR,2015); cal.set(Calendar.DAY_OF_MONTH, 27); cal.set(Calendar.HOUR_OF_DAY,13); cal.set(Calendar.MINUTE,00); Intent myIntent1 = new Intent(this, AlarmBroadCustReciver.class);

Differentiate Application object from Activity and BroadcastReceiver on Android

自闭症网瘾萝莉.ら 提交于 2019-12-01 09:46:54
I have an application that relies on push notifications to update users of events happening online. To do so, I have my normal Activity which displays the game to the user, and then a BroadcastReceiver which exists to process incoming push messages. However, whenever we receive a message, it creates an instance of our Application. In our Application.onCreate() function we perform some preloading and processing logic that should only run when the Application being created is the actual Activity and not the BroadcastReceiver. I also tried to move the processing and logic into the Activity

What is the best way of create BroadcastReceiver?

懵懂的女人 提交于 2019-12-01 09:37:28
问题 I have spent few days to work on Service + BroadcastReceiver, but still cannot make it perfect. I hope someone can help, thanks! I am writing a App that show user current location on map(The map that I wrote, not Google Map) and send out Notification alarm when user go inside a predefined zone. In my code. there are two main objects. A GPS service and Main Activity. The GPS service broadcast location when location changed. The Main Activity receive the latest location by BroadcastReceiver. I

How to identify the ringing state of outgoing call in android

元气小坏坏 提交于 2019-12-01 09:23:01
In my app i want to identify whether the outgoing call state like waiting,received or rejected by other side. I searched a lot in these below links Outgoing call status How to detect answered or rejected state in outgoing call , outgoing call information through android BroadcastReceiver , identify outgoing call connect event But couldn'd find a proper answer.Plz help me.Thanx. I know its been a while but i hope to be helpful for someone still looking for a solution! I recently had to work on a similar project where i needed to capture the ringing state of an outgoing call and the only way i

Android : Catching Outgoing SMS using ContentObserver or receiver not working

时光怂恿深爱的人放手 提交于 2019-12-01 09:18:53
i trying to catch outgoing SMS event using content observer. //TEST OBSERVER ContentObserver co = new SMSoutObserver(new Handler(), getApplicationContext()); ContentResolver contentResolver = getApplicationContext().getContentResolver(); contentResolver.registerContentObserver(Uri.parse("content://sms/out"),true, co); // END TEST OBSERVER and public class SMSoutObserver extends ContentObserver { private Context mCtx; public SMSoutObserver(Handler handler, Context ctx) { super(handler); mCtx = ctx; } @Override public void onChange(boolean selfChange) { super.onChange(selfChange); // save the

Accessing a database through a broadcastreceiver on RECEIVE_BOOT_COMPLETED

别来无恙 提交于 2019-12-01 08:30:12
When the phone is finish booting up I want to automatically re-register some alarms, based on hour, minute ++ infomation from a database. I try to do this with a broadcastreveiver, but it won't work. It crashes when trying to accessing the database(DB) helper class on boot up. The DB helper class works fine when accessing it through the app. Is this possible or do I have to use some alternative solution like a service? You do not want to do database I/O in any manifest-registered broadcast receiver. You do not know how long it will take (based on other device activity), and your onReceive()

Differentiate Application object from Activity and BroadcastReceiver on Android

谁都会走 提交于 2019-12-01 08:25:55
问题 I have an application that relies on push notifications to update users of events happening online. To do so, I have my normal Activity which displays the game to the user, and then a BroadcastReceiver which exists to process incoming push messages. However, whenever we receive a message, it creates an instance of our Application. In our Application.onCreate() function we perform some preloading and processing logic that should only run when the Application being created is the actual

Accessing a database through a broadcastreceiver on RECEIVE_BOOT_COMPLETED

半世苍凉 提交于 2019-12-01 07:24:25
问题 When the phone is finish booting up I want to automatically re-register some alarms, based on hour, minute ++ infomation from a database. I try to do this with a broadcastreveiver, but it won't work. It crashes when trying to accessing the database(DB) helper class on boot up. The DB helper class works fine when accessing it through the app. Is this possible or do I have to use some alternative solution like a service? 回答1: You do not want to do database I/O in any manifest-registered