android-service

Local broadcast from Service not received by Activity

做~自己de王妃 提交于 2019-12-12 09:36:22
问题 I have an Activity in which I am registering a BroadcastReceiver locally as follows: public class SomeActivity extends Activity{ public static final String PERFORM_SOME_ACTION = "PERFORM_SOME_ACTION"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.some_activity_layout); ..... ..... IntentFilter filter = new IntentFilter(); filter.addAction(PERFORM_SOME_ACTION); receiver = new BroadcastReceiver() { @Override public

BroadcastReceiver for WALLPAPER_CHANGED calls onReceive() multiple times : Android

半世苍凉 提交于 2019-12-12 09:33:49
问题 I have a BroadcastReceiver and declared it like this: <receiver android:name="com.services.Receiver" android:enabled="true" android:exported="true" > <intent-filter android:priority="999" > <action android:name="android.intent.action.WALLPAPER_CHANGED" /> </intent-filter> </receiver> and the receiver is: @Override public void onReceive(final Context context, final Intent intent) { change_wallpepar.myPrefs = context.getSharedPreferences("myPrefs", Context.MODE_PRIVATE); new Handler()

Android process is bad error on killing the app

烈酒焚心 提交于 2019-12-12 08:56:59
问题 Here is the exact error 02-08 12:36:43.490 3479-4980/? W/ActivityManager: Scheduling restart of crashed service com.wfl/.StepTrackerShakeDetectorService in 1000ms 02-08 12:36:44.494 3479-3513/? W/ActivityManager: Unable to launch app com.wfl/10139 for service Intent { cmp=com.wfl/.StepTrackerShakeDetectorService }: process is bad Here is the scenario It is basically a step tracker StepTrackerShakeDetectorService is implemented to restart automatically when app is destroyed using START_STICKY

Vibrate on push notification

空扰寡人 提交于 2019-12-12 08:38:47
问题 First of all I've checked all those links: How to Call Vibrator inside a Service in android Android notifications and vibrate from service Android GCM turn on Lights But I can't achieve my phone vibrating when I receive a push notification. Here goes my code: PushReceiver public class PushReceiver extends FirebaseMessagingService { public PushReceiver() { } @Override public void onMessageReceived(RemoteMessage remoteMessage) { if(remoteMessage.getData() != null){ Map<String, String> data =

Should I use Service or IntentService for my android app?

北慕城南 提交于 2019-12-12 08:29:17
问题 Please correct me If I am wrong : 1) A Service is used to perform long tasks in background. A service runs in the UI thread so if there comes a long task then it may freeze our UI. A service will continue to run independent of application as long as we tell it to stop. 2) An IntentService on the other hand is used to perform short tasks in separate thread. It automatically terminates when it finishes its task. What I have to do : 1) check for location every 5 seconds 2) if there is a change

Android self-signed MotionEvent APK

孤街醉人 提交于 2019-12-12 06:17:44
问题 I am developing an android APK that will do auto touch events in my mobile when certain button is clicked, I am following the solution provided by the link: How to simulate touch from background service with sendevent or other way? I have the signapk.jar from here, and I use the public and private test key provided also, the command I entered are: java -jar ./signapk.jar ./testkey.x509.pem ./testkey.pk8 ./app-debug.apk ./app-signed.apk and it did generate a new signed APK to me as I expected:

Service Stopping in Android

隐身守侯 提交于 2019-12-12 05:26:51
问题 I have Android Service that runs always in background, and another service which is triggered by the always running service which is alarmmanager service. Howewer, I want to stop service with a button, my aim is to stop always running service so the alarm manager service will automatically be stopped. Is it correct perspective? My sample code is as follows package com.example.deneme; public class AndroidNotifyService extends Activity { /** Called when the activity is first created. */

Android - How can a Service App dispatch KeyEvents to another Foreground App

孤街醉人 提交于 2019-12-12 04:49:19
问题 I want to develop an Android Service app that dispatches KeyEvents to the foreground application. Somehow, it would be like this I cant seem to find a way how, I am only familiar with the activity dispatches KeyEvents to itself, like this: @Override public boolean dispatchKeyEvent(KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (event.getKeyCode() == KEYCODE_1) { // Do something } else if (event.getKeyCode() == KEYCODE_2) { // Do something } } else if (event.getAction()

Unable to start service Intent { cmp=com.appstech.knowntrack/.MyLocationService } U=0: not found

亡梦爱人 提交于 2019-12-12 04:47:40
问题 Manifest file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.appstech.knowntrack"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission

Android AlarmManager or Service?

你说的曾经没有我的故事 提交于 2019-12-12 04:45:43
问题 I have an application, that has a main.java file that sets up an alarm to call a recurring service. However when I close the application the service is no longer called for some weird reason. So I was reading around what I should be doing for my application (basically what I want is something like Twicca, where the twitter app continues to run even if you close it from your "task manager"). And it looks like what I need to do is deploy my entire application as a service, so that it will keep