android-service

getting the Notifications in 4.1 and above in android

五迷三道 提交于 2019-12-05 04:10:30
问题 How to get the notifications in android using Accessibility Service above 4.0? Why onAccessibilityEvent(AccessibilityEvent event) not calling When Notification fired above 4.0 Please give Proper Suggestion Thanks in advance @Override public void onAccessibilityEvent(AccessibilityEvent event) { final int eventType = event.getEventType(); System.out.println("MyServ.onAccessibilityEvent()"); switch (eventType) { case AccessibilityEvent.TYPE_VIEW_FOCUSED: Toast.makeText(getApplicationContext(),

Can a third-party app implement CallScreeningService in android 7?

喜夏-厌秋 提交于 2019-12-05 03:57:01
Android API level 24 introduces a new Service called the CallScreeningService . The documentation says that the service can by implemented by the default dialer to screen incoming calls. I would like to implement this service in my own app, preferably without creating an entire dialer app, but a simple naive implementation seems to be ignored by the OS when an incoming call happens. AndroidManifest.xml snippet: <service android:name="com.example.callbouncer.CallService" android:permission="android.permission.BIND_SCREENING_SERVICE"> <intent-filter> <action android:name="android.telecom

Local broadcast from Service not received by Activity

僤鯓⒐⒋嵵緔 提交于 2019-12-05 02:39:11
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 void onReceive(Context context, Intent intent) { // perform some action ... } }; registerReceiver(receiver

Clarification of setUpdateCurrent on OneOffTask

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 01:53:30
问题 I'm trying to wrap my head around the behaviour of setTag and setUpdateCurrent of OneoffTask in the GcmNetworkManager tooling. The documentation of setUpdateCurrent says this: Optional setter to specify whether this task should override any preexisting tasks with the same tag. This defaults to false, which means that a new task will not override an existing one. Fair enough, but it doesn't say what will happen to a task, it only says one thing that will not happen - i.e. the task will not

PendingIntent to launch and stop a Service

旧时模样 提交于 2019-12-05 01:34:52
I'm trying to make a simple widget with a button that start a Service with the OnClickPendingIntent() . I can start it fine but I can't figure out a way to stop it (I know I can do it with a BroadcastReceiver or something similar but I would like to avoid hardcode). This is my code: Intent intent = new Intent(context, myService.class); PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.my_widget); if (!ismyserviceup(context)) { views.setOnClickPendingIntent(R.id.my_button, pendingIntent); } else

Android media player seekbar

这一生的挚爱 提交于 2019-12-05 01:14:43
问题 I have a service that creates, plays and handles a mediaplayer (just audio), yet I have a seekbar in the main activity that I want to, naturally, show the progress of the audio file and allow the user to seek to various positions. What I'm having a hell of a time figuring out is: what would be the best or proper way to connect the seekbar in the UI to the mediaplayer in the service? 回答1: Here is how I would do this: Bind to service that plays audio. The interface that server returns in onBind

How to set the Permission WRITE_SECURE_SETTINGS in android? [duplicate]

让人想犯罪 __ 提交于 2019-12-05 00:44:55
This question already has an answer here: How can I get the dreaded WRITE_SECURE_SETTINGS permission for my android app? 3 answers I am trying to enable the Accessibility Service Settings above 4.0 but It is showing an Exception i.e., Caused by: java.lang.SecurityException: Permission denial: writing to secure settings requires android.permission.WRITE_SECURE_SETTINGS In Manifest I have Declared This permission like this. <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> But in manifest giving compilation Error i.e., Permission is only System Apps. So i am not

Activity and Background Service Access to SQLite Database

北城余情 提交于 2019-12-05 00:23:51
问题 I want to check if a SQLite Database is open, and if it is, I would like to access that Database within a service class. I am worried, and have seen, that multiple open calls to the database clash, and throw exceptions. Because I do query the database within both my Activity and Service classes, I am attempting to implement the solution Commonsware recommended here: When to close db connection on android? Every time after your operation finished or after your app exit. However I do not want

Scheduled Alarm Manager not working Android

久未见 提交于 2019-12-05 00:21:50
问题 I am trying to start an alarm service that repeats every day at a particular time. I have gone through a lot of threads on stack overflow regarding this but no luck. I followed a few tutorials: http://karanbalkar.com/2013/07/tutorial-41-using-alarmmanager-and-broadcastreceiver-in-android/ and http://javatechig.com/android/repeat-alarm-example-in-android My service is never started and I do not understand why. Below is my code: My Manifest file: <uses-sdk android:minSdkVersion="8" android

Add my app to AutoStart apps list in android programmatically

笑着哭i 提交于 2019-12-05 00:00:17
I want my app to be in the autostart list after installation. I know when I install an app like (whatsapp) it goes automatically to the autostart list. I want my app to be the same I tried the code in this question How to Autostart an Android Application? but unfortunately non of the answers actually made the app autostart. Not sure if I am doing something wrong the reason that I need the app be autostart is just to get notifications from the webservice. as the app does not get notifications unless its open or autostart is on would appreciate your help thanks Few popular apps run in background