broadcastreceiver

Widget onUpdate is not setting pendingIntent on button click after reboot

我是研究僧i 提交于 2019-12-05 19:45:26
I'm creating a test widget that shows random number by clicking its button. everything is inside onUpdate of my Provider independently, including the pendingIntent . it works fine but after rebooting the phone views.setOnClickPendingIntent is not working although RemoteViews is recreated with no issue but the button becomes unresponsive. public class TestWidget extends AppWidgetProvider { static HashMap<Integer, BroadcastReceiver> br = new HashMap<>(); static void updateAppWidget(Context context, final AppWidgetManager appWidgetManager, final int appWidgetId) { context = context

Android BroadcastReceiver without intent filters

非 Y 不嫁゛ 提交于 2019-12-05 19:22:24
问题 I saw in few android ad networks sdks that they are declaring BroadcastReceiver with no intent filters. Something like this: <receiver android:name="com.example.SampleReceiver" /> My guess is that such receiver would capture all possible events. So I've tried doing it myself and created a SampleReceiver : public class SampleReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { System.out.println("Event captured: " + intent.getAction()); } } I

Uninstall application uninstallreceiver not called

人走茶凉 提交于 2019-12-05 18:37:00
After lots of google I have found some good solutions to find out uninstall receiver of application.I am referring First Link and Second Link . In Second link you can find source code of uninstalldetection created by dickfala.I have tried this code on my devices which has android 4.1.2 and 4.0.4 Os but whileing running the app on device I am not able to see logs of application in logcat and application just uninstalled from device. I know too much discussion already done on this topic but I am not able to find any proper solution for it that's why I have asked this question.Anyone know please

Mobile Number verification for dual SIM devices in Android

走远了吗. 提交于 2019-12-05 18:16:28
I have done the sim/mobile number verification (same like Whats APP) part in my app. something like: Send Message Part: SmsManager sm = SmsManager.getDefault(); sm.sendTextMessage(mobileNumber, null, "Welcome", null, null); Check the message received by the same/current device through BroadcastReceiver: private class SMSReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { if(intent.getAction() != null && intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){ Bundle extras = intent.getExtras(); if (extras == null){ _submit.setText

How to get BroadcastReceiver for Action :android.intent.action.MAIN and android.intent.category.HOME in My Android Application

和自甴很熟 提交于 2019-12-05 17:36:18
Every One Can i Get BroadcastReceiver for This Intent when i press home Key : Starting activity: Intent { act=android.intent.action.MAIN cat= [android.intent.category.HOME] flg=0x10200000 cmp=com.htc.launcher/.Launcher } I don't want to Consider com.htc.luncher as it will we different for Other Android Device . Here i my Simple Class For BroadcastReceiver : public class HomeBrodcast extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); } } In Manifest : <receiver android:name="xxx.yyy.zzz.sss.HomeBrodcast"> <intent

Wi-Fi scanning without broadcast receiver?

你说的曾经没有我的故事 提交于 2019-12-05 17:25:47
I have created wi-fi scanner. It continually scans for available wi-fi networks. But my question is why would exactly broadcast receiver is needed if i can actually run scanning (invoke startScan() with timer every x seconds) and receive the same results without creating broadcast receiver? This is broadcast receiver code in onCreate() method: i = new IntentFilter(); i.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); receiver = new BroadcastReceiver(){ public void onReceive(Context c, Intent i){ WifiManager w = (WifiManager) c.getSystemService(Context.WIFI_SERVICE); List<ScanResult> l = w

Problem with BroadcastReceiver (Receiver not registered error) [duplicate]

可紊 提交于 2019-12-05 16:16:55
This question already has answers here : Closed 7 years ago . Possible Duplicate: Receiver not registered exception error? I have a TabActivity and the 'content' of each TabSpec is my own GuideListActivity class. There are seven tabs (one for each day of the week) and each GuideListActivity shows TV Guide info for one TV channel / one day of the week. The TabActivity maintains which channel number the user is viewing guide details for and when the user changes to view another channel's info, the TabActivity uses sendStickyBroadcast() with an Intent identifying which channel's info to display

Android capture new outgoing call [duplicate]

岁酱吖の 提交于 2019-12-05 15:36:01
Possible Duplicate: Android: Redirect outgoing calls The requirement is to replace newly dialed number with another one. I have captured the ACTION_NEW_OUTGOING_CALL event and used Intent.EXTRA_PHONE_NUMBER to get the current outgoing number and then I have used setResultData inside my class(which extends BroadcastReceiver) to replace the dialed number. Basically code is, if (Intent.ACTION_NEW_OUTGOING_CALL.equals(action)) { String phonenbr = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); Log.d("OutGoingNum", "phonenbr is " + phonenbr); if (phonenbr.startsWith("00")) { setResultData(

Android - Extract text from SMS

若如初见. 提交于 2019-12-05 15:26:42
I want to be able to extract text from received SMS's. I'm not sure whether I should use content providers or the sms message is included in the intent received by broadcast receiver. I have a broadcast receiver waiting for SMS's, and want to inspect the contents of the received message. Thank you. You can create SmsMessage instances from the Intent in your BroadcastReceiver as follows: Bundle bundle = intent.getExtras(); Object[] pdus = (Object[])bundle.get("pdus"); SmsMessage[] messages = new SmsMessage[pdus.length]; for (int i = 0; i < pdus.length; i++) { messages[i] = SmsMessage

Android BroadcastReceiver onReceive() called twice on android 5.1.1 even after one register

北战南征 提交于 2019-12-05 15:12:52
I Could not figure out what is wrong with below code. I also checked about registering receiver twice. But that's also not the case. or may be I am missing something. Could any please help. I really need it. :( import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.IBinder; import android.telephony.TelephonyManager; import android.util.Log; import android.widget.Toast; /** * * @author Bharat * */ public class CallNotifierService extends