android-broadcastreceiver

Boot/Broadcast Receiver reboot issues

本小妞迷上赌 提交于 2019-12-12 16:38:19
问题 This is a fairly common question but I'm losing my mind. I think I've been thorough with the requirements. I want a BroadcastReceiver to do something when the phone restarts. My BroadcastReceiver (for Booting): public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("BootupReceiver", "Refreshing alarms."); } } Within my Manifest's 'manifest' tag: <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

Local broadcast from Service not received by Activity

做~自己de王妃 提交于 2019-12-12 09:36:22
问题 I have an Activity in which I am registering a BroadcastReceiver locally as follows: public class SomeActivity extends Activity{ public static final String PERFORM_SOME_ACTION = "PERFORM_SOME_ACTION"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.some_activity_layout); ..... ..... IntentFilter filter = new IntentFilter(); filter.addAction(PERFORM_SOME_ACTION); receiver = new BroadcastReceiver() { @Override public

Dynamic broadcast registration for SMS_RECEIVED is not working

自作多情 提交于 2019-12-12 03:56:35
问题 Registering broadcast receiver for SMS_RECEIVED action in AndroidManifest.xml file <receiver android:name=".SmsReceiver"> <intent-filter> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> works as expected, SmsReceiver.onReceive(Context context, Intent intent) is called. Trying to register dyamically Intent inte = registerReceiver( new SmsReceiver(), new IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION)); SmsReceiver.onReceive(Context context

BroadcastReceiver doesnt receive when app is closed

浪子不回头ぞ 提交于 2019-12-11 17:23:16
问题 I know this question is similar to many questions of BroadcastReceiver but as I read, non of them have solutions. the tutorial of BroadcastReceiver tells it will work even app was not running in the background, my question is why I can not use it when app is not running I tried to call broadcast from main activity, use service and .... but non of them solved my problem. here is my CODE: MyReceiver java Class: public class MyReceiver extends BroadcastReceiver { @Override public void onReceive

Broadcast receiver not working when app is cleared from RAM

允我心安 提交于 2019-12-11 13:32:52
问题 I am new to android. I am making an alarm clock. Its working perfectly until the user clears the app from the RAM. On searching, I found that broadcast receivers don't work if the app is cleared from the RAM. So, what exactly should I do? Will sending the broadcast from a service help? Also if you have a link to a good tutorial to Services in android, pls do share. Also let me know if there is some other way to solve my problem. 回答1: In Xiaomi devices, you just have to add your app to

Should BroadcastReceiver be declared inside activities?

别来无恙 提交于 2019-12-11 12:49:16
问题 I'm wondering what's the better cleaner design approach to handle BroadcastReceiver creation between those two: Declaring directly a BroadcastReceiver in an Activity/Fragment and overriding onReceived method there. Creating another custom receiver class in a package "receiver", that extends the BroadcastReceiver class and override onReceive. Then, you instantiate that custom receiver class in your Activity/Fragment. 回答1: There are 2 types of Broadcast Receivers 1)Dynamic Broadcast Receiver

Android Sip incoming Call using Service with Broadcast Receiver

 ̄綄美尐妖づ 提交于 2019-12-11 12:22:36
问题 Hai Every one Actually am trying to create an application which supports for making a audio call over the internet with SIP based,here am using native sip,and i was facing the problem with the incoming call,i have done the registration part with service,but while doing the incoming call i can not able to answer the call kindly please help me Service file package example.com.myapplication; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent

open fragment from Firebase onMessageReceived

Deadly 提交于 2019-12-11 05:57:13
问题 I'm trying to open a fragment when a new Notification is received. For this I use a BroadcastReceiver. Problem is I'm not getting the message in my Activity from sendNotification method inside FirebaseMessagingService class. I think the issue is I declared the IntentFilter inside onCreate and its not being called when I click on the push notification. Is there any other way to do this? // Globally declared private IntentFilter mIntentFilter; @Override protected void onCreate(@Nullable Bundle

How to send a data from a broadcast receiver to fragment?

本秂侑毒 提交于 2019-12-11 05:20:02
问题 How to send a data from a broadcast receiver to fragment? Here I want to send the phonenumber (OriginatingAddress) to another fragment. public void onReceive(Context context, Intent intent) { Bundle intentExtras = intent.getExtras(); if (intentExtras != null) { Object[] sms = (Object[]) intentExtras.get(SMS_BUNDLE); String smsMessageStr = ""; for (int i = 0; i < sms.length; ++i) { SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) sms[i]); String smsBody = smsMessage.getMessageBody()

ClassLoader referenced unknown path

拟墨画扇 提交于 2019-12-11 05:16:14
问题 I am developing a personal medicine time reminder application.It is working almost properly except the fact that it is stopping after notifying the medicine time a few times. While monitoring the log cat of the application i found that it is stopping the alarm receiver after getting the following Warning. W/System: ClassLoader referenced unknown path: /data/app/com.example.sakkar.medicineschedular-2/lib/arm Can anyone help me to solve this problem? 回答1: It's been few weeks now and not sure if