broadcastreceiver

Android - how to make my app default sms app programatically

北战南征 提交于 2019-12-18 03:47:19
问题 I am developing an sms blocking app. Which is working fine up to Jelly-Bean. And its not working from Kitkat to Marshmallow. I searched on google and everyone recommending to take permission from user to make it default sms app of this phone by using . if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if(!Telephony.Sms.getDefaultSmsPackage(getApplicationContext()).equals(getApplicationContext().getPackageName())) { Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE

Android. Launch app from Dialer

百般思念 提交于 2019-12-18 03:39:33
问题 This is what I have so far but nothing happens when I input this combination in dialer public class DialReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, final Intent intent) { if (intent.getAction().equals(android.content.Intent.ACTION_NEW_OUTGOING_CALL)) { String phoneNumber = intent.getExtras().getString( android.content.Intent.EXTRA_PHONE_NUMBER ); if(phoneNumber.equals("*#588637#")) { Intent intent1 = new Intent(context , Activity.class); intent1

No such method getITelephony to disconnect Call

半城伤御伤魂 提交于 2019-12-18 03:32:34
问题 i want to disconnect outgoing call in ICS. My issue is first of all I am not getting the broadcast in IC` in Gingerbread it is working fine and blocking the calls but in ICS its not Broadcasting. for BroadCast I created a service and in that I am getting BroadCast of PHONE_STATE in ICS also but when i try to disconnect call I am getting error of NO such method name 'getITelephony' in ICS call is not disconnecting. I am using following code to disconnect call using the BroadCast... try{

NotificationManager.cancel(id) is not working inside a broadcast receiver

会有一股神秘感。 提交于 2019-12-18 03:32:30
问题 Android: I am trying to cancel a notification from the notification bar after a package being installed. What I am doing is the following: public class MyBroadcastReceiver extends BroadcastReceiver { private static final String TAG = "MyBroadcastReceiver"; @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_PACKAGE_ADDED.equals(action)) { Uri data = intent.getData(); //some code goes here //get the id of the notification to

How to correctly filter Package replaced broadcast

时光总嘲笑我的痴心妄想 提交于 2019-12-18 03:04:40
问题 I am trying to catch the package replaced broadcast for my app and only my app, but for some reason in my reciever I am the broadcast for every app that is updated. I thought you only needed to set the intent filter in the manifest file to your app, but maybe I am wrong? Here's my code(manifest): <receiver android:name=".UpdateReciever"> <intent-filter> <action android:name="android.intent.action.PACKAGE_REPLACED" /> <data android:scheme="package" android:path="com.my.app" /> </intent-filter>

Unregistering Android Broadcast Receiver in onReceive throws “Receiver not registered”

一个人想着一个人 提交于 2019-12-18 01:57:25
问题 I have a BroadcastReceiver for one time use. I'm registering it in an Activity. I can't put the unregisterReceiver() in onPause because it has to stay running even when the activity is paused or destroyed. I want the BroadcastReceiver to unregister itself when it is done, something like this: public class SmsReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { // do some code.. context.unregisterReceiver(this) } } But it causes an Exception: Receiver

Android MediaProjectionManager in Service

◇◆丶佛笑我妖孽 提交于 2019-12-18 01:18:35
问题 I want to build an app where I have to use MediaProjectionManager in a Service. But I can not solve it as 'startActivityForResult' can't use in Service class. 回答1: I really want to do this from a service, which is how I found this question. This is the closest I've came up, so just throwing this out there, till a better answer comes along. Here's a way to do it from an activity that's almost like doing it from a service: import static your.package.YourClass.mediaProjectionManager; public

how to unlock the screen when BroadcastReceiver is called?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 01:13:06
问题 As you can guess, i register an alarm by AlarmManager. And the BroadcastReceiver will be called correctly. But when it called, my phone screen is still locked. I notice the default AlarmClock application is not like this. So my question is, how to unlock the screen when the BroadcastReceiver is called ? (Unlock the screen can make the user to operate my Activity directly) Thanks in advance. 回答1: The source code for the alarm clock is in the Android source code. AlarmClock is gone, but has

Android Service Listener for the wakelock screen

杀马特。学长 韩版系。学妹 提交于 2019-12-17 21:36:56
问题 Hii all, Im developing an emergency calling application. What i want is when some person uses this specific code the phone will unlock and then only my application would be running. Im juz thinking i need a reciever for it and just wondering wether i will have to create my own Home screen and a lock screen for my application. any ideas on this please??? many thanks in advance :) 回答1: There is no sanctioned way to replace the lock screen. See Is there a way to override the lock pattern screen?

how to start my application when ever mobile restart or turn on

六眼飞鱼酱① 提交于 2019-12-17 21:22:47
问题 How do i set my application as startup application, so when ever mobile restarts or turned ON, my application starts. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.installedapps22" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> <application android:icon="@drawable/cherry_icon" android:label="@string/app_name"> <activity android:name="