broadcastreceiver

Broadcast Receiver not working for SMS

99封情书 提交于 2019-11-28 11:27:04
First of all I already searched for possible solutions, tried everything and it still didn't work. I must be missing something. I am trying to create an app that receives/reads and writes SMS. the write part is working just fine, my broadcast receiver just doesn't catch broadcast. AndroidManifest.xml <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.WRITE_SMS" /> <uses-permission android:name="android.permission.READ_SMS" /> ... <receiver android:name=".SmsReceiver"

My BroadcastReceiver is not receiving the BOOT_COMPLETED intent after my N1 boots

给你一囗甜甜゛ 提交于 2019-11-28 11:21:49
I am unable to get my BroadcastReceiver onReceive method called using the BOOT_COMPLETED intent. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jerrellmardis.umbrella" android:versionCode="4" android:versionName="1.0.3"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"> <activity android:name=".activities.Umbrella" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" />

How can I launch fragment in broadcast receiver

无人久伴 提交于 2019-11-28 11:09:15
问题 How can I use broadcast receiver to start/lunch fragment for example : if I need to start/luanch activity , I can use intent : public void onReceive(final Context context, Intent intent) { this.context = context; this.intent = intent; try { Bundle bundle = intent.getExtras(); int messageID = bundle.getInt("id"); intent = new Intent(context, GetAlarm.class); intent.putExtra("id",messageID); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch (Exception e) {

Why does Intent.createChooser() need a BroadcastReceiver and how to implement?

可紊 提交于 2019-11-28 10:56:43
The following snippet, called from my implementation of onOptionsItemSelected() , works nicely to carry the user from my app to a mail client with email address, subject and body pre-filled. I'm using this as a simple way to let the user give me feedback. String uriText = "mailto:" + emailAddress + "?subject=" + subject + "&body=" + body; Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uriText)); startActivity(Intent.createChooser(emailIntent, "Pick an email app:")); When the mail app opens (on my Nexus S with Android 4.0.4), LogCat outputs the following, and I can't figure out

In Android how do you register to receive headset plug broadcasts?

ⅰ亾dé卋堺 提交于 2019-11-28 10:33:44
I am working in Android 2.1, and I want to detect when the headset is plugged in/taken out. I'm pretty new to android. I think the way to do it is using a Broadcast receiver. I sublcassed this, and I also put the following in my AndroidManifest.xml. But do you have to register the receiver somehwere else, like in the activity? I'm aware there are lots of threads on this, but I don't really understand what they're talking about. Also, what's the difference between registering in AndroidManifest.xml versus registering dynamically in your activity? <receiver android:enabled="true" android:name=

BOOT_COMPLETED intent not received on all devices

孤街浪徒 提交于 2019-11-28 09:54:07
问题 I have created an application that receives BOOT_COMPLETED within a receiver using the following filter: <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> I receive this on one device but I have another device that does not receive this despite using the same APK. What device-specific issues could prevent a particular device from receiving this intent? Is there any way to test for this and create a remedy? 回答1: Make sure that you are doing a real full reboot. Some

android broadcast receiver (call and sms received) not working in android nougat

不羁岁月 提交于 2019-11-28 09:52:10
问题 android call and SMS broadcast receiver working perfectly till marshmallow 6.0, but in android nougat , it is not working when app is closed, and when app is in background, then its working fine in android nougat(N). please can anyone help me for this issue. public class CallReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) { savedNumber = intent.getExtras().getString(

Scheduled Notifications Triggers Every Time I Open App

假装没事ソ 提交于 2019-11-28 09:24:03
问题 I am building an app which triggers a notification at 11:30 IST..I have Tested It Its Working But After 11:30 Whenever i open my app it issues a notification... i don't know why i think it should be some error in condition in time checking... i want notification to be triggered on time only once in a day...and then the next day...:) please resolve this thanks in advance **MainActivity.java** @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Why won't this broadcast receiver work in Lollipop?

倖福魔咒の 提交于 2019-11-28 09:16:13
问题 I have this broadcast receiver declared in the Manifest: <receiver android:name="classes.VoiceLaunchReceiver" > <intent-filter> <action android:name="android.intent.action.USER_PRESENT" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> It does its thing whenever the user unblock and turns on the screen. It works perfectly in Jellybean 4.3 and lower. Why won't it work in Lollipop? (I already know that the systems send that intent, what I want is to

Send string from service to activity

夙愿已清 提交于 2019-11-28 09:14:31
Im trying to send string from service to my main activity with broadcast. i have read in a few forums that there are 2 ways to use broadcast. one is to register the activity in the manifast and the second way is to do it on the activity, local. i would like to know how can i use the second way. i have tried to do it but unfortunately i did not succeed. please tell me what im doing wrong. Service code public class MyGcmListenerService extends GcmListenerService { private static final String TAG = "MyGcmListenerService"; // [START receive_message] @Override public void onMessageReceived(String