android-broadcastreceiver

WakefulBroadcastReceiver is deprecated

℡╲_俬逩灬. 提交于 2019-12-03 01:54:36
For creating a receiver I'm extended WakefulBroadcastReceiver in my old project. But now it's deprecated . Instead of WakefulBroadcastReceiver which Receiver I should use now and how to convert below code with new method? Here is my code: public class TaskFinishReceiver extends WakefulBroadcastReceiver { private PowerManager mPowerManager; private PowerManager.WakeLock mWakeLock; @Override public void onReceive(Context context, Intent intent) { mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); turnOnScreen(); Intent wakeIntent = new Intent(); wakeIntent

Properly tracking install referrals on Play Store

梦想与她 提交于 2019-12-02 23:08:52
I have a simple task: I want to track the referral id of an app install and pass it to backend. What I did: I created a link with an extra parameter referrer and appended it to the invite link. When it is opened, the javascript detects if the browser is an Android mobile browser and then prepares an intent and issues a redirect to that intent. While preparing the intent, referrer field is extracted from the url and appended to the intent like this: intent://scan/#Intent;scheme=com.example.android;package=com.example.android&referrer=4;end And here is my code for BroadCastReceiver : public

setRepeating of AlarmManager not respond within the time indicated

自古美人都是妖i 提交于 2019-12-02 12:06:58
AlarmManager should be repeated every 1 minute, but repeated every 1, 2, 3 or 4 minutes. Since the application I throw AlarmManager public class PacienteApp extends Application { @Override public void onCreate() { AlarmManager gps = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(this, GpsReceiver.class); PendingIntent pending = PendingIntent.getBroadcast(this, 0, i, 0); gps.setRepeating(AlarmManager.RTC, System.currentTimeMillis(), 1000 * 60, pending); } } Since BroadcastReceiver call a IntentService. public class GpsReceiver extends BroadcastReceiver {

Access the results of a started service from two different activities in Android

心已入冬 提交于 2019-12-02 07:49:21
问题 I have a service that gets the user's location and broadcasts the latitude and longitude in an intent. I believe that I need the service to be a started service (as opposed to bound service), because I would like for it to be able to send a push notification to the user when a new geoFire entry from firebase enters their radius even when the app is closed. Currently, the service is set up to broadcast the location. Given that the location service will be a started service, I don't know how to

Android - get a reference to a BroadcastReceiver defined in Manifest

£可爱£侵袭症+ 提交于 2019-12-01 20:26:01
Is there any way how to get a reference for a BroadcastReceiver defined in Manifest.xml from code? In my case, we are using a BroadcastReceiver that needs to be included in the Manifest.xml. However it has functionality I would like to reuse from within our code. So instead of creating another similar BroadcastReceiver and instantiating it from the code I would like to obtain a reference to the existing one. Additional information: My goal is to subscribe to an event on my BroadcastReceiver from my activity - an event that I would like to reuse - instead of creating another instance of this

Android Broadcast receiver for call not working? (Marshmallow)

核能气质少年 提交于 2019-12-01 12:14:44
问题 I am trying to display toast after receiving an call, I have implemented all necessary things needed to register broadcast receiver but it is not displaying toast. I am trying to run this program on Marshmallow device MyCallReceiver.java - package com.suhas.callreceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.telephony.TelephonyManager; import android.util.Log; import android.widget.Toast; public class

Mobilock app starts before BOOT_COMPLETED broadcast… How is it possible?

跟風遠走 提交于 2019-12-01 11:01:00
There is a kiosk app called Mobilock. This app starts way faster (Almost 5 seconds before) than my own app which starts with BOOT_COMPLETED broadcast. My own app has the highest priority which is max value of integer. So this is not about the priority. These guys have found a way to start their application 5 second sooner than BOOT_COMPLETED broadcast. Has anyone got an idea about what they are doing? Listen also to android.intent.action.QUICKBOOT_POWERON and android.intent.action.LOCKED_BOOT_COMPLETED . It seems to be device-dependant, which broadcast is sent first. Oh my god! I've luckily

Accepting a Call via Bluetooth Headset

流过昼夜 提交于 2019-11-30 11:48:12
i am working on a VoIP-Android-App. I would like to accept and decline Calls via a connnected Bluetooth Headset in an Activity. What I have tried so far: Using a Media Session to receive Media Button clicks. Problem: If we start BluetoothSCO we do not receive any Media Button clicks. If we do not start BluetoothSCO we do receive Media Button clicks but we cannot differentiate long and short button clicks because downtime is always 0, the keycode is always KEYCODE_MEDIA_PLAY and the ACTION_DOWN is immediately followed by ACTION_UP. Those problems only occur if we are connected via Bluetooth. If

Android 7 intent extras missing

旧城冷巷雨未停 提交于 2019-11-30 09:36:47
Does anyone know if there are any changes to how Android 7.0 (Nougat) handles intent extras compared to Android 6.0 (Lollipop)? Long story short: my app works as intended on all versions from 4.1(16) to 6.0(23) but crashes on android 7.0(24)! The app creates a pending intent with an intent to a custom broadcast receiver which has extras. However, on android 7 none of the extras are present in the intent received by the broadcast receiver. MainActivity.java Intent intent = new Intent(context, PollServerReceiver.class); // TODO: Remove after DEBUGGING is completed! intent.putExtra("TESTING1",

Why SMS Retriever API don't work in release mode?

隐身守侯 提交于 2019-11-29 18:15:14
问题 I've implemented the SMS Retriever API like in the google tutorials and in my debug Build Variant work fine. I can read the sms and get the code to the user can do the login. My problem is when I run the app in release Build Variant the sms it doesn't work. I receive the sms but I can't read the code to do the login. I change the hash generated with AppSignatureHelper in release mode that is differente than in the debug mode. In debug work and in release no. Some help will be appreciate The