android-broadcast

Listen to own application uninstall event on Android

感情迁移 提交于 2019-11-26 22:12:00
As far as I know, apps can't get intents for their own uninstallation: ACTION_PACKAGE_FULLY_REMOVED ACTION_PACKAGE_REMOVED But how does Dolphin Browser manage to receive a "removed" event and start a browser as in the attached image ? ADB: 10-20 12:37:00.997: D/BackupManagerService(527): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:mobi.mgeek.TunnyBrowser flg=0x8000010 (has extras) } 10-20 12:37:00.997: V/BackupManagerService(527): removePackageParticipantsLocked: uid=10112 #1 10-20 12:37:01.007: D/dalvikvm(527): GC_EXPLICIT freed 2247K, 12% free 20128K

AlarmManager does not work when app is force closed

爱⌒轻易说出口 提交于 2019-11-26 21:19:37
问题 Documentation for AlarmManager startes that Note: The Alarm Manager is intended for cases where you want to have your application code run at a specific time, even if your application is not currently running. For normal timing operations (ticks, timeouts, etc) it is easier and much more efficient to use Handler. However, once my application is closed (force close from task manager) my alarm does not work and the OnReceive method is never called inside the broadcast receiver. I am targeting 4

Android 8.0 Oreo AlarmManager with broadcast receiver and implicit broadcast ban

£可爱£侵袭症+ 提交于 2019-11-26 20:56:31
问题 I have critical reminders that are set via the Alarm Manager (It should function the same way as an alarm clock application). Previously I had the following in my Android Manifest: <receiver android:name="com.example.app.AlarmReceiver" > <intent-filter> <action android:name="${packageName}.alarm.action.trigger"/> </intent-filter> </receiver> The broadcast receiver: public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive( final Context context, final Intent

Android Broadcast Receiver bluetooth events catching

旧巷老猫 提交于 2019-11-26 18:56:05
I'm trying to catch bluetooth state changes with Broadcast Receiver. My manifest: <uses-permission android:name="android.permission.BLUETOOTH" /> <application> <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name=".BluetoothBroadcastReceiver" android:label="@string/app_name"> <intent-filter> <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" /> <action android:name="android

Repeating Alarm Manager After reboot

≯℡__Kan透↙ 提交于 2019-11-26 18:34:59
问题 i want to create broadcast AlarmManager(repeating) with Notification message.i pass my calender object from Pickers. If i don't reboot my device it works normally. However, when i reboot my device,as you know my calander object will be null. How can i manage my repeating alarm after rebooting and how can i hold my Calendar schedules? Thanks for your ideas. public class MyReceiver extends BroadcastReceiver { private static final int PERIOD = 10000; final public static String ALARM_ID =

How to get sms sent confirmation for each contact/person in android?

这一生的挚爱 提交于 2019-11-26 17:57:57
I want to send sms to multiple people and verify whether sms sent or not. I checked multiple links (mentioned here) and got the idea of using PendingIntent and broadCast Receiver for confirmation. Practical way to find out if SMS has been sent Sending text messages programmatically in android http://mobiforge.com/design-development/sms-messaging-android But the key problem is that, I have different 50 contacts number in an arrayList and their different msgs in another arrayList . I use this code : for (Condition) { sms = SmsManager.getDefault(); try { . . . sms.sendTextMessage(phoneNumbers[i],

How to trigger MediaScan on Nexus 7?

可紊 提交于 2019-11-26 16:46:45
问题 Because I want to make sure the MediaStore has the latest information without having to reboot I'd like to trigger the MediaScanner using the popular way I found on SO context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); This works fine on my Samsung S2 w/ICS but not on my Nexus 7 w/JellyBean. Logcat shows this on my Nexus 7: WARN/ActivityManager(480): Permission denied: checkComponentPermission() owningUid=10014

Using LocalBroadcastManager to communicate from Fragment to Activity

ε祈祈猫儿з 提交于 2019-11-26 14:40:06
问题 EDIT: This question was created as part of one of my first Android projects when I was just starting out with Android application development. I'm keeping this for historical reasons, but you should consider using EventBus or RxJava instead. This is a gigantic mess. Please DO NOT CONSIDER using this. Thank you. In fact, if you want something cool that solves the problem of using a single activity with multiple "fragments", then use flowless with custom viewgroups. I have implemented a way to

Pop up window over Android native incoming call screen like true caller Android app

百般思念 提交于 2019-11-26 12:15:34
问题 I am developing a broadcast receiver for incoming calls in Android and on getting incoming calls I want to inflate a pop up over the native incoming call screen. I completed that code. But now the problem is that in the Android 4.1 (Jelly Bean) API level 17 when a phone rings, the PHONE_STATE is coming as OFF HOOK , and if I am calling an activity, it gets called, but the code under it doesn\'t get executed. I am listing the code: My broadcast receiver package com.example

Music player control in notification

穿精又带淫゛_ 提交于 2019-11-26 12:02:14
问题 how to set notification with play/pause, next and previous button in android.! I am new with Android & also at stack overflow. So please bear with me. I set notification when song is start to play like below : ` @SuppressLint(\"NewApi\") public void setNotification(String songName){ String ns = Context.NOTIFICATION_SERVICE; NotificationManager notificationManager = (NotificationManager) getSystemService(ns); @SuppressWarnings(\"deprecation\") Notification notification = new Notification(R