broadcastreceiver

GCM BroadcastReceiver fired only when app is running or running at background

强颜欢笑 提交于 2019-12-11 02:34:24
问题 I've implemented GCM service and it all works fine but when I'm supposed to recieve a notification after I closed the app (By long click at home button and then at the garbage icon - Galaxy S III), I don't recieve it. Here's my Manifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.proj" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="18"

How to turn on screen when new notification is sent in the status bar?

牧云@^-^@ 提交于 2019-12-11 02:31:47
问题 This is my code in setting up a notification and it works: @Override public void onReceive(Context context, Intent intent) { category = (String) intent.getExtras().get("CATEGORY"); notes = (String) intent.getExtras().get("NOTES"); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( context).setSmallIcon(R.drawable.ic_launcher) .setContentTitle(category)

intent.setAction() and intent.getAction() not working in BroadcastReceiver

拥有回忆 提交于 2019-12-11 02:21:42
问题 I am using BroadCaastReceiver to allow user perform offline events.The issue is that it is never going inside intent.getAction().equals("beenthereclicked") if i try switching on wifi few seconds after clicking on beenThereView.However it does go inside if (wifi.isAvailable() || mobile.isAvailable()) whenever i switch on wifi.I failed to understand why intent.setAction() and intent.getAction() not working.I can see wificonnected in my log but can't see beenthereclicked in my log. i wrote this

android package restarted broadcast not working

删除回忆录丶 提交于 2019-12-11 01:58:12
问题 I am developing an app which needs a broadcast when app opens every time. I had registered the receiver in manifest like this. <receiver android:name="package.broadcast.example" > <intent-filter> <action android:name="android.intent.action.PACKAGE_RESTARTED" /> <data android:scheme="package"/> </intent-filter> </receiver> But i cant able to receive the broadcast. I spent 3 hours on this still i cant find wats the mistake. Can anyone refer me the working example of this broadcast. Thanks. 回答1:

How to identify which file triggered Download_Complete intent

£可爱£侵袭症+ 提交于 2019-12-11 01:55:46
问题 I'm developing an application that will Download another apk file, and asks for it's installation. Since my target is GingerBread I'm using the DownloadManager class. Is there anyway to know which downloaded file triggered the DOWNLOAD_COMPLETE intent? 回答1: It's stored in EXTRA_DOWNLOAD_ID: public static final String EXTRA_DOWNLOAD_ID Since: API Level 9 Intent extra included with ACTION_DOWNLOAD_COMPLETE intents, indicating the ID (as a long) of the download that just completed. Constant

Implicit Broadcasts

♀尐吖头ヾ 提交于 2019-12-11 01:52:34
问题 "Apps that target Android O can no longer register broadcast receivers for implicit broadcasts in their manifest." ACTION_VIEW is an implicit broadcast. According to the above statement, one can no longer register as a broadcast receiver for any URI in the manifest. The only way to listen for a URI at this point is if the app is already running? 回答1: ACTION_VIEW is an implicit broadcast. Not typically. ACTION_VIEW is used to start an activity, not as a broadcast Intent action. one can no

How to receive broadcasts of RINGER_MODE_CHANGED_ACTION

你说的曾经没有我的故事 提交于 2019-12-11 01:51:40
问题 I have the following broadcast receiver: public class MyRingModeReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Logger.iLog("In my Receiver"); } } I then have a service that onCreate does the following: IntentFilter filter = new IntentFilter(); filter.addAction("android.media.RINGER_MODE_CHANGED"); registerReceiver(new MyRingModeReceiver() , filter); When I place a call to the emulator and use the volume keys to modify (silence) the

Broadcast receiver / service in Android vs. iPhone

霸气de小男生 提交于 2019-12-11 01:38:47
问题 I have a application in Android that has a broadcast receiver that clear any existing alarms and triggers a new repeating alarm, daily, which starts a service to show a notification. This is all done on background, app not running. I really don't understand the iPhone docs if this is allowed due the "background service" guidance by Apple. Is this all doable in iPhone? How? Can I have some sort of broadcast receiver running every day, then start a service to show notification if the date meets

No enclosing instance of the type MainActivity is accessible in scope

走远了吗. 提交于 2019-12-11 01:36:50
问题 I have this code, which i want to get GPS latitude and longitude from GPSTracker class But the error show gps=new GPSTracker(MainActivity.this); gps.getLatitude(); No enclosing instance of the type MainActivity is accessible in scope The complete code BootComplete.java public class BootComplete extends BroadcastReceiver{ //private static final String PREFS_NAME = null; public static final String PREFS_NAME = "MyPrefs"; String storedSimSerial; String currentSimSerial; String email; //email

TelephonyManager.CALL_STATE_RINGING calls twice while one call ringing

為{幸葍}努か 提交于 2019-12-11 01:28:49
问题 I use descendant - class of PhoneStateListener: class CallStateListener extends PhoneStateListener { @Override public void onCallStateChanged(int state, String incomingNumber) { switch (state) { case TelephonyManager.CALL_STATE_RINGING: if (incomingNumber!=null) { // code for incoming call handling } break; } super.onCallStateChanged(state, incomingNumber); } this is my BroadcastReceiver: class ServiceReceiver extends BroadcastReceiver { CallStateListener phoneListener; @Override public void