broadcastreceiver

how to fire notification from BroadcastReceiver?

☆樱花仙子☆ 提交于 2019-12-30 16:26:44
问题 how to fire notification from BroadcastReceiver (can't use most methods and can't use "this")? I need it to open a activity with info from the DB I already did it but now must of the methods dosen't work and I cant use "this" 回答1: In the onReceive method you get a Context object. So use it to get the NotificationManager and fire your notification. public void onReceive(Context ctx, Intent intent) { NotificationManager nm = (NotificationManager)ctx.getSystemService(Context.NOTIFICATION_SERVICE

How can I create a project in Android Studio to function default SMS app

旧时模样 提交于 2019-12-30 11:19:10
问题 Continuation of the previous query, see: SMS Receiver for AND API 19 and higher I need to make the application run in the background and I could have it after installing the set as a default as shown here: http://android-developers.blogspot.cz/2013/10/getting-your-sms-apps-ready-for-kitkat.html So I asked how to create a project to display a list of the "Super Duper SMS," which finally set as default. The whole program must running as a service, without the need any screen for basic functions

AlarmManager firing in emulator but not on physical device

Deadly 提交于 2019-12-30 11:18:06
问题 I have an application that calls AlarmManager Intent intent; intent = new Intent(context, MyEventReceiver.class); PendingIntent appIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_ONE_SHOT); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), appIntent); and in the Manifiest I have the obligatory entry <receiver android:name=".MyEventReceiver" android:process="

BroadcastReceiver not receiving intent

左心房为你撑大大i 提交于 2019-12-30 11:05:40
问题 So now I have my BroastcastReceiver declared in the manifest file... <receiver android:name=".MyReceiver"> <intent-filter> <action android:name="android.intent.action.CALL_BUTTON" /> </intent-filter> </receiver> I want to catch the intent when the Call button is pressed. Here is my code... public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "intent received", Toast.LENGTH_LONG); if(intent.getAction()

Do android broadcast receivers consume battery life?

最后都变了- 提交于 2019-12-30 09:33:11
问题 I have two receivers that are listening for android.intent.action.BOOT_COMPLETED and android.intent.action.PACKAGE_REPLACED . I was wondering how much battery life they are causing my phone to consume since they cause my app to constantly run now. 回答1: The broadcast receivers themselves will not directly consume much battery life. BOOT_COMPLETED happens once; PACKAGE_REPLACED happens only on an application upgrade. Those probably average one event per day. Now, if those broadcast receivers do

Do android broadcast receivers consume battery life?

不打扰是莪最后的温柔 提交于 2019-12-30 09:32:18
问题 I have two receivers that are listening for android.intent.action.BOOT_COMPLETED and android.intent.action.PACKAGE_REPLACED . I was wondering how much battery life they are causing my phone to consume since they cause my app to constantly run now. 回答1: The broadcast receivers themselves will not directly consume much battery life. BOOT_COMPLETED happens once; PACKAGE_REPLACED happens only on an application upgrade. Those probably average one event per day. Now, if those broadcast receivers do

Call activity method from broadcast receiver android?

狂风中的少年 提交于 2019-12-30 07:48:09
问题 In my application I am sending a port SMS to the mobile. And when the message is recieved I need to perform some task in my activity and update the UI. Manifest Declaration of receiver <receiver android:name="com.vfi.BinarySMSReceiver" > <intent-filter android:priority="10" > <action android:name="android.intent.action.DATA_SMS_RECEIVED" /> <data android:host="*" android:port="9512" android:scheme="sms" /> </intent-filter> </receiver> Receiver class public class BinarySMSReceiver extends

Can android application have only broadcast recevier and service without activity

爷,独闯天下 提交于 2019-12-30 07:26:30
问题 Can android application have only broadcast recevier and service without activity ? If this is possible how can i invoke broadcast receiver ? Android system automatically invokes the broadcsat receiver ? Code of Broadcastreceiver public class CheckReceiver extends BroadcastReceiver { public Context con; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub Toast.makeText(context, "Received", Toast.LENGTH_LONG).show(); // add PhoneStateListener

Android MMS Broadcast receiver

▼魔方 西西 提交于 2019-12-30 07:09:28
问题 I am working on a MMS broadcast receiver. It already starts when receiving a MMS but I dont know how to capture / parse the contents of the mms like it is done with sms in this example: import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsMessage; import android.util.Log; public class SMSBroadcastReceiver extends BroadcastReceiver { private static final String SMS_RECEIVED = "android

How to Cancel AlarmManager on a Scheduled time

≡放荡痞女 提交于 2019-12-30 05:30:22
问题 How can I cancel one AlarmManager on a scheduled time, which was already started. I am starting one AlarmManager like this. I want to cancel it after 5 hours. How can I do this? AlarmManager service = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(context, MyStartServiceReceiver.class); PendingIntent pending = PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, 30);