broadcastreceiver

Accelerometer seems to only work for a few seconds?

爱⌒轻易说出口 提交于 2019-12-11 11:30:02
问题 With this in the Android Manifest: <receiver android:name=".OnBootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver> And the following as OnBootReceiver.class: package io.cordova.hellocordova; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.hardware.Sensor; import android.hardware

Comunication between Service, Web and Activity, back and forth, in Android

情到浓时终转凉″ 提交于 2019-12-11 11:26:38
问题 I read most of the questions and answers around SO and I must say I still have no idea on which way to go, in my case. There are several ways to go with but I can't really decide which one is best suited for my case. What I've got I have an Service that gets started from my app. It checks the current location of the user and calls a web service with the read location. This occurs every x meters. What I want to obtain Have an activity with a map and display the current location readings from

android.net.conn.CONNECTIVITY_CHANGE broadcast receiver not fires in JellyBean for VPN connection and disconnection

大城市里の小女人 提交于 2019-12-11 10:49:41
问题 This is manifest part <receiver android:name="my.com.app.ConnectivityModifiedReceiver" android:label="NetworkConnection" > <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> </receiver> This is java code public class my.com.app.ConnectivityModifiedReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { context.sendBroadcast(new Intent("ConnectivityModified")); } } The ConnectivityModifiedReceiver will

Global intents that are fired for all Android notifications

ぐ巨炮叔叔 提交于 2019-12-11 10:49:03
问题 Are their any global intents that are fired for all Android notifications? I know there are a few specific kind like PHONE STATE & SMS RECEIVED , but are there any others? 回答1: No there is no global intent that is broadcasted for every Notification. 回答2: Actually, it's pretty easy to write one. Simply add a that corresponds to every possible action, and it should do the job. 来源: https://stackoverflow.com/questions/7797147/global-intents-that-are-fired-for-all-android-notifications

Android Alarm Manager with Broadcast receiver

梦想的初衷 提交于 2019-12-11 10:44:22
问题 Hello I have my Alarm Manager to show a Notification. The problem is that once the alarm is triggered and the notification is shown, when the code of MainActivity(super.onCreate) is executed, it always triggers the notification. Here is my MainActivity which executes the Alarm. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initAlarm(); } private void initAlarm(){ Calendar calendar = Calendar

BroadcastReceiver onReceive is not fired

帅比萌擦擦* 提交于 2019-12-11 10:11:33
问题 I'm trying to cope with SMS receiving funcions in Android. I read a lot of related topics on Stackoverflow and other sites and I tried with a very simple Class that simply print on the console that a message has been received and the message, but I cannot figure out why it doesn't work. I see that similar questions remained unanswered in the past (see Android - Broadcast Receiver not being fired) Hope someone could find where's the problem with my code. Code: package com.storassa.android

InstantiationException when using newInstance on BroadcastReceiver

别说谁变了你拦得住时间么 提交于 2019-12-11 10:06:03
问题 I do have a class with lots of static convenience methods. One of them should start a BroadcastReceiver dynamically - but it always returns an InstantiationException. The BroadcastReceiver has a no-parameter constructor so it should work - but it doesn't. Here's what I did so far: Here's the convenience method in it's class: // Static convenience methods in a tools class public class MyTools { // Start BroadcastReceiver dynamically public static BroadcastReceiver startBroadcastReceiver

Whatsapp service restarts after force stop when push notification received

让人想犯罪 __ 提交于 2019-12-11 09:58:13
问题 We are trying to understand the behavior of whatsapp service in Samsung S5 and above models. In these models whatsapp application is embedded to the ROM of the device, which you cannot uninstall it. Even I force stop the application, whatsapp service becomes running and displays the message when a push notification received. I have tried it in Nexus 5 device on which whatsapp is not on ROM. In this case after force stop, whatsapp cannot receive push notification and service is still not

Broadcast receiver is not registering (working) in Android Pie

淺唱寂寞╮ 提交于 2019-12-11 09:48:49
问题 Here my code is working till Marshmallow devices but in my Pie devices it is not working. I read a Google documentation and found remove the receiver tag from manifest and add in activity but I can't understand how to add. Main problem is when I adding a value in offline mode its stores a value in SQLite but when come in back online mode it does not send SQLite data to server above nogout devices. Here is my activity: broadcastReceiver = new BroadcastReceiver() { @Override public void

broadcastreceiver in case of android device switched off and on not working

99封情书 提交于 2019-12-11 09:43:36
问题 I am using broadcast receivers for performing some action when the device is switched off and switched on again,but they are not working.These are the receivers in manifest file: <receiver android:name=".ShutdownReceiver" > <intent-filter> <action android:name="android.intent.action.ACTION_SHUTDOWN" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.QUICKBOOT_POWEROFF" /> </intent-filter> </receiver> <receiver android:name=".RestartReceiver" > <intent-filter>