broadcastreceiver

broadcastreceiver onReceive problem ACTION_MEDIA_BUTTON Android

五迷三道 提交于 2019-12-06 11:39:22
I've found a lot of pages about this in the web, but none of them helped me. I've been for hours stucked in this problem. That's why i decided to make my own question. What I want to do is an application that receives an intent of the type ACTION_MEDIA_BUTTON and the method onReceive() of the Broadcastreceiver does something. My Activity is like this: public class MusicControlActivity extends Activity { private MediaButtonIntentReceiver receiver = new MediaButtonIntentReceiver(); @Override public void onCreate(Bundle p_SavedInstanceState) { super.onCreate(p_SavedInstanceState); setContentView

How to implement 'pop up box' in Android similar to Viber (when a message is received)

瘦欲@ 提交于 2019-12-06 11:09:09
问题 I work as a junior Android developer and the client has requested the following: "Make research about implementation of pop up box, while application is in background. Thea idea is always when there is notification to show in notification panel, also to be shown in pop up box." (Viber was taken as an example of this) I know how to work with activities and fragments and views in Android, but I don't know how to even google about this so I thought someone could point out a tutorial or just say

Not able to catch each sms status

a 夏天 提交于 2019-12-06 11:07:51
问题 Im trying to catch the status of each sms delivery but my code is not getting it but instead the status of only one message. Anyone can give hints? This si my code.. This is working but I need to catch each status of each sms. public void sendMultipart(String msgbody,String msg_receipients,Intent intent) { BroadcastReceiver smsStatusReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { context.unregisterReceiver(this); //unregister receiver

java.lang.ClassCastException while running new `runnableThread` in `Service` Class

China☆狼群 提交于 2019-12-06 10:53:06
问题 I have an application , contains a broadcastReceiver which listens to all new received SMS . If any new SMS received this BroadcastReceiver starts a background Service which runs GPS and return the coordinates , this coordinate retrieving needs a new thread to be run , in the Service class there is no getApplicationContext() so I used 'getContentBase()' for starting the new thread this is the code ((Activity)getBaseContext()).runOnUiThread(new Runnable() { ((Activity)getBaseContext())

Incoming number during a call in android?

北战南征 提交于 2019-12-06 10:09:04
问题 I am running following code, its compiling but I am not getting any result or toast displayed please help... CustomBroadcastReceiver.java this class will receive the action phone state change and will instantiate the customephonestatelistener public class CustomBroadcastReceiver extends BroadcastReceiver { TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener(context);

BroadCast Receiver Active only when activity is running else deactivated

假如想象 提交于 2019-12-06 09:45:12
Hi i am using a broadcast receiver for location listening but this broadcast receiver is working only when activity is in foreground else when i am not using this app then receiver is not active here is code of activity onCreate's method where i am registering my broadcast receiver PendingIntent proximityIntent = PendingIntent.getBroadcast(getApplicationContext(), i, intent, PendingIntent.FLAG_UPDATE_CURRENT); locationManager.addProximityAlert( latitude, // the latitude of the central point of the alert region longitude, // the longitude of the central point of the alert region 1000, // the

Push Notification receiver is not working

做~自己de王妃 提交于 2019-12-06 09:24:22
I'm implementing push notification service i my app, I followed the tutorial on Android developers.com , but unfortunately, i did not receive any notifications. I'm receiving the registration id successfully, but,the device doesn't receive any notifications from the back end, although the back ed service receives a successful response. p.s : I'm sure from the implementation of the back end service that sends the notification to Google cloud servers. Could any one help me solving this problem..?, thanks in advance. Below you can find my implementation. The Manifest.xml <?xml version="1.0"

update ui from broadcast receiver

南笙酒味 提交于 2019-12-06 09:04:11
I have a MainActivity where i want to update UI after a AlarmManager is called every 2 minutes.. Please help me how to do this This is my MainActivity public class MainActivity extends AppCompatActivity { private Toolbar toolbar; GPSTracker gps; TextView lat1, long1; Button exit, refresh; private PendingIntent pendingIntent; private static MainActivity mInst; double newLat, newLong; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.app_bar); toolbar.setTitle("PWD

Android - Create a background service to receive PubNub messages

青春壹個敷衍的年華 提交于 2019-12-06 08:53:38
I am using PubNub API to get real time messages. I have implemented code to subscribe to my channel and receive ongoing messages. I just want these messages to receive in background even if my application is not open. I have learned about services and broadcast receiver in android but I am not understanding the how to use this with PubNub. Is there any proper way to achieve this? PubNub Subscribe Code public static final String GLOBAL_CHANNEL = "NAME_OF_MY_CHANNEL"; public void subscribe() { Callback callback = new Callback() { @Override public void connectCallback(String channel, Object

Android - How to receive the BOOT signal with an application installed on sdcard?

流过昼夜 提交于 2019-12-06 08:51:56
I need to start a notification service for an application when the device boots. I have implemented a BroadcastReceiver that listens to the boot signal in order to start the service. However, this works only if the application is not installed on sdcard (because the signal is received before the sdcard is mounted). Is there any solution to keep installing the application on sdcard and yet still receive that signal? Any hack for this? Let me know! Thanks! You could either: Register an account in the AccountManager and set up a sync service ( tutorial1 , tutorial2 ) -- Android will start your