broadcastreceiver

How to check the gps Tracking half hour once using Broadcast Receiver?

╄→гoц情女王★ 提交于 2019-12-08 12:09:02
问题 Hai am trying to get the gps location using BroadCast Receiver.its working fine,But i want to get the location every half hour once.i used **MINIMUM_TIME_BETWEEN_UPDATES ** 30mts .i got when latitude and longitude value changed update public class MainActivity extends Activity implements LocationListener { final DBAdapter1 db=new DBAdapter1(this); private ConnectivityReceiver receiver = null; private TextView txtNetworkInfo ; private static TextView latituteField; private static TextView

want to have sound when the app is installed

寵の児 提交于 2019-12-08 11:56:06
问题 I want to have a sound when my application is installed. I tried this by using broadcastreciever in my application. In the broadcast reciever iam running a service to start media player. But iam not able to get into on recieve method of the broadcast reciever. but if i try to install another app iam getting the event. how to get the event in my app only. My permissions in manifest file <uses-permission android:name = "android.permission.INSTALL_PACKAGES"/> <uses-permission android:name=

Android BroadcastReceiver Not being called after app closed from Running App List

一笑奈何 提交于 2019-12-08 11:15:14
问题 In attempting to implement notifications in an android app, I am seeing that the notifications no longer work if a user closes the app from the Running App List (top swipe down and then horizontal swipe - not force quit which properly would shut down all future invocations as per google specs). Using the back button sometimes causes the same behaviour, though not always. My understanding from everything that I have researched is that only a force stop by the user should stop the Broadcast

Send/Receive Intents in the same class

蹲街弑〆低调 提交于 2019-12-08 10:47:27
问题 Simple question, Is it possible to send/receive intents in the same class through LocalBroadcastReceiver ? If yes can you show me an example? 回答1: Yes, LocalBroadcastReceiver works everywhere. Here's an example for an Activity : BroadcastReceiver localBroadcastReciever = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d("BroadcastReceiver", "Message received " + intent.getAction()); } }; @Override protected void onStart() { super.onStart();

Android: Broadcasting Sensor data from a Service to an Activity

不羁岁月 提交于 2019-12-08 10:44:55
问题 I am trying to learn Android app development and wrote a very simple app consisting of an activity that calls a service. The service broadcasts measured acceleration to the activity. The problem is that the service runs ok but it does not send data back to the activity. i.e, onReceive on my receiver is never called. Also, when the activity ends, there is an exception saying that my receiver has not been registered. Below is my code for the service, activity and manifest.xml. Any help would be

Getting 'You need to use a Theme.AppCompat theme (or descendant) with this activity.' while trying to show an AlertDialog from BroadcastReceiver

北慕城南 提交于 2019-12-08 10:28:08
问题 I'm sending a Broadcast from a service and then receiving it back from inner BroadcastReceiver class. I have to show an AlertDialog based on some logic but while trying to do it, I'm getting this runtime error: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. Here's MyBroadcastReceiver class: public class MyBroadcastReceiver extends BroadcastReceiver { public MyBroadcastReceiver(){ super(); } @Override public void onReceive(final

How to check if a BroadCast Sender has a custom permission to send it

会有一股神秘感。 提交于 2019-12-08 10:23:29
问题 I have a plugin for my app that is started with a BroadCast. I already managed to add a custom permission, so only apps with the permission can receive the broadcast. However, I have no idea how to achieve the more important part: How can I check, if the sender has a custom permission, so only my main app can send the broadcast? I know this is possible, but I don't know how to do it. Thanks! 回答1: Try using: Context ctx = ...; int result = ctx.checkCallingPermission("your.permission.goes.here"

Broadcast Receiver for Cast Connectivity in Android

邮差的信 提交于 2019-12-08 09:12:46
问题 I don't want to use google cast code to connect devices from my app but needed to just check whether the phone is connected to any cast Device. Do we get any Receiver/listener for this check? Thanks! EDIT: I have tried to get Cast State as following as mentioned by Chris, Add following in Manifest <meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:value=".CastOptionsProvider" /> Create CastOptionProvider Class public class CastOptionsProvider

Can't call a service from Broadcast receiver in Android

孤者浪人 提交于 2019-12-08 09:06:44
问题 I have a Broadcast Receiver which is activated when a internet connection is activated. I want the broadcast receiver to activate a service to find my current location. I have tested it on the phone and it is giving me a force close. can anyone suggest me what to do step by step coz I am new to sevices and Broadcast Receivers. My code is a follows: GPSTracker.java public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status

Why i am not able to create the Notification in OnReceiver of BroadcastReceiver?

≡放荡痞女 提交于 2019-12-08 09:06:24
问题 I am going to create the notification and want to show it on the onReceiver of the BroadcastReceiver. But i am not able to do it. why ? The code for my class is: public class AlarmNotificationReceiver extends BroadcastReceiver{ //private Intent intent; private NotificationManager notificationManager; private Notification notification; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub long value1 = intent.getLongExtra("param1", 0); String