broadcastreceiver

Dismiss Ongoing Android Notification Via Action Button Without Opening App

微笑、不失礼 提交于 2019-12-17 09:35:18
问题 I have an app that has an ongoing notification to help with memorization. I want to be able to dismiss this notification with one of the action button, but I don't want to open the app when the button is hit. I would prefer to use the built-in notification action buttons and not create a RemoteViews object to populate the notification. I saw one post mention using a BroadcastReceiver on this button which is received in my app, and though his tutorial was quite unhelpful, it sounds like this

unfortunately app is getting stopped while checking for network

独自空忆成欢 提交于 2019-12-17 08:53:25
问题 I am using the following code to check for the internet connection through out my app. public class ConnectionChangeReceiver extends BroadcastReceiver { @Override public void onReceive( Context context, Intent intent ) { ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService( Context.CONNECTIVITY_SERVICE ); NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo(); NetworkInfo mobNetInfo = connectivityManager.getNetworkInfo(ConnectivityManager

How to repeat notification daily on specific time in android through background service

守給你的承諾、 提交于 2019-12-17 08:32:07
问题 Hi I am working on application where I have set the notification on user entered date and time through background service. Now I want to set notification/alarm daily at 6 pm to ask user does he want to add another entry? How can I achieve this? Should I use the same background service or Broadcast receiver? Please give me better solution for that and tutorial will be great idea. Thanks in advance. 回答1: First set the Alarm Manager as below Calendar calendar = Calendar.getInstance(); calendar

How to repeat notification daily on specific time in android through background service

两盒软妹~` 提交于 2019-12-17 08:31:00
问题 Hi I am working on application where I have set the notification on user entered date and time through background service. Now I want to set notification/alarm daily at 6 pm to ask user does he want to add another entry? How can I achieve this? Should I use the same background service or Broadcast receiver? Please give me better solution for that and tutorial will be great idea. Thanks in advance. 回答1: First set the Alarm Manager as below Calendar calendar = Calendar.getInstance(); calendar

Service Intent must be explicit: Intent

依然范特西╮ 提交于 2019-12-17 08:28:28
问题 I have an app some time now in which I call a service through a broadcast receiver (MyStartupIntentReceiver). The code in the broadcast receiver in order to call the service is: public void onReceive(Context context, Intent intent) { Intent serviceIntent = new Intent(); serviceIntent.setAction("com.duk3r.eortologio2.MyService"); context.startService(serviceIntent); } The problem is that in Android 5.0 Lollipop I get the following error (in previous versions of Android, everything works ok):

Sending intent to BroadcastReceiver from adb

眉间皱痕 提交于 2019-12-17 08:24:02
问题 I've got BroadcastReceiver class: public class IntentReceiver extends BroadcastReceiver { final String tag = "Intent Intercepter"; @Override public void onReceive(Context context, Intent intent) { try { String data = intent.getStringExtra("sms_body"); Log.i(tag, data); Toast.makeText(context, data.subSequence(0, data.length()), Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(context, "Intercepted", Toast.LENGTH_LONG).show(); } } } And also in manifest: <receiver android:name

Call an activity method from a BroadcastReceiver class

隐身守侯 提交于 2019-12-17 07:32:41
问题 I know I can do an inner receiver class to call any method from my receiver But my main activity is too damn big and does a lot of things. So I will need a class that extends broadcast receiver but who isn't an inner class. And can call one method from my main activity. I don't know if it's possible but my activity is a Home activity and a "singleInstance" activity so maybe with this detail someone has a way to access to my activity. If it's impossible any way to split some java code in

Is it possible to define a broadcast receiver as an inner class in manifest file? [duplicate]

北慕城南 提交于 2019-12-17 07:24:33
问题 This question already has answers here : Receiver as inner class in Android (6 answers) Closed 6 years ago . I want to create a broadcast receiver as an inner class in my main activity. But I have problems defining the broadcast receiver in manifest xml file, because android can't find it. Code: public class MyActivity extends Activity{ ... public class Receiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { .... } } ... } Manifest: <receiver

Broadcast Receiver Not Working After Device Reboot in Android

假装没事ソ 提交于 2019-12-17 07:03:11
问题 I have already checked all the related questions and have not found any solution for this problem. So this is an absolutely new problem for me. What I Have I have an Android app which registers a few broadcast receivers in its manifest. This is what my manifest looks like. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.app.myapp"> <uses-permission android:name="android

Broadcast Receiver Not Working After Device Reboot in Android

柔情痞子 提交于 2019-12-17 07:03:06
问题 I have already checked all the related questions and have not found any solution for this problem. So this is an absolutely new problem for me. What I Have I have an Android app which registers a few broadcast receivers in its manifest. This is what my manifest looks like. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.app.myapp"> <uses-permission android:name="android