broadcastreceiver

BroadcastReceiver Intent.ACTION_PACKAGE_ADDED/REMOVED Android Oreo

穿精又带淫゛_ 提交于 2019-12-24 01:37:09
问题 This is my broadcast receiver class and the implementation of it in main. Problem is that onReceive method never gets called. class MyBroadcastReceiver : BroadcastReceiver() { override fun onReceive(p0: Context?, p1: Intent?) { Toast.makeText(p0, "It works", Toast.LENGTH_LONG).show() } } class MainActivity : AppCompatActivity() { ...... private var broadcastReceiver: MyBroadcastReceiver = MyBroadcastReceiver() override fun onCreate(savedInstanceState: Bundle?) { ...... registerReceiver

Why don't we register broadcast receiver for BOOT_COMPLETED events

一个人想着一个人 提交于 2019-12-24 01:17:50
问题 I am confused about the a concept here. I read on many tutorials that in order to get notified when device has booted (say for purpose of re-scheduling an alarm), you need to have a boot_completed broadcast receiver. However the confusing part is that no where I see a method like "register(boradcast receiver)". People just have the broadcast receiver class and they have it in manifest. but dont you need some sort of registration process? How will the system know that there is an APP x who has

android services life time continuation

被刻印的时光 ゝ 提交于 2019-12-24 01:04:28
问题 In mainactivity I have Broadcast Receiver, pending intent, and alarm manager. It triggers as per selected time (System.currentTimeMillis() + smstimeinmilliseconds). Intent intent = new Intent(this, DBBroadcastReceiver.class); intent.putExtra("message", message); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, id, intent, 0); AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() +

Fetching methods from BroadcastReceiver to update UI

若如初见. 提交于 2019-12-24 00:28:12
问题 I am trying to update the UI according to change of a variable in BroadcastReceiver . Thus, I need to call a method (to get the variable I mentioned) of a class which extends BroadcastReceiver in MainActivity depending on but I cannot get the true return value in any way. The class which extends BroadcastReceiver is this: public class ProviderChangeReceiver extends BroadcastReceiver { private static boolean isProviderActive; @Override public void onReceive(Context context, Intent intent) {

android.net.wifi.STATE_CHANGE not broadcasting when wifi get enabled and WifiManager.EXTRA_WIFI_STATE not available

老子叫甜甜 提交于 2019-12-24 00:23:11
问题 Manifest: <receiver android:name=".triggers.WifiTrigger"> <intent-filter> <action android:name="android.net.wifi.STATE_CHANGE" /> </intent-filter> </receiver> Permissions : <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android

open application After incoming or outgoing call diconnection

大憨熊 提交于 2019-12-23 16:34:12
问题 I am creating an application, where I am getting call history in a listview , now what I am trying is after any incoming or outgoing call disconnection,I want to open that listview , but I don't know my app is not opening. my listview page is not displayed after any call, following is my code public class MainActivity extends Activity { private ListView listview=null; private String callType=null; private String phoneNumber=null; private String callDate=null; private String callDuration=null;

use Broadcast Receiver to catch incoming call, onReceive not triggered?

半腔热情 提交于 2019-12-23 15:33:45
问题 I want to implement a simple BroadcastReceiver, it gets triggered when there's an incoming call. However, it seems onReceive is never triggered (I checked the LogCat very carefully, no output there), what was wrong? Tks My class: public class MyPhoneReceiver extends BroadcastReceiver { private static final String TAG = "DEBUG"; @Override public void onReceive(Context context, Intent intent) { Log.e(TAG, "Test loggiiiiiiiiiiiiiiiiiiiiiiiiing!"); } } My manifest file: <?xml version="1.0"

How to unregister Listener & stop service from within broadcastreceiver

余生长醉 提交于 2019-12-23 15:10:14
问题 In my App I have a broadcast receiver that upon receiving a keyword in an SMS message, it starts a service that tracks the GPS location of the phone. I do this using - context.startService(new Intent(context,TrackGPS.class)); I also need to be able to stop the service upon receiving another keyword in an SMS message, I have tried to do this but the GPS sensor still tracks the location and GPS icon flashes at the top of the screen. I tried to do this using - context.stopService(new Intent

Created BroadcastReceiver which displays application name and version number on install/ uninstall of any application?

落爺英雄遲暮 提交于 2019-12-23 11:58:36
问题 Created BroadcastReceiver which displays application name and version number on install/ uninstall of any application. But i am getting package name through intent.getData() . But when i am trying to find the name of that application using packagemanager it's throwing an exception in all the cases Install/ Uninstall/ Replaced. What could be the possible problem and how can this be fixed? CODE: import android.content.BroadcastReceiver; import android.content.Context; import android.content

Activity opened twice

纵然是瞬间 提交于 2019-12-23 09:32:00
问题 I have an application that uses Urban Airship for push notification. When a notification arrives and the user clicks on it, activity A in my application should open and do something. I've installed the BroadcastReceiver as is shown in the docs, and it's almost working. When my app is in the foreground I don't let the user see the notification at all, and just handle it automatically. When my app is not running at all, the activity opens up just fine. When my app is in the background (which