android-service

Loading a service after booting in android [closed]

谁说我不能喝 提交于 2020-01-06 08:11:54
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I has taken a sample from internet for implementing service that starts automatically after phone boots. But application shows error. Please help me to

Get the new variable into the JSON String after getting the new value from the server

拜拜、爱过 提交于 2020-01-06 07:16:09
问题 I am starting my TrackingService class from the MainActivity which just contains this onCreate() method: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent i = new Intent(this, TrackingService.class); startService(i); } I am sending some data route, long, lat, mac to the server. When the route is not 0 I am getting the following response from the server {"status": 201} . Often the routes is 0 then

Get the new variable into the JSON String after getting the new value from the server

纵然是瞬间 提交于 2020-01-06 07:15:42
问题 I am starting my TrackingService class from the MainActivity which just contains this onCreate() method: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent i = new Intent(this, TrackingService.class); startService(i); } I am sending some data route, long, lat, mac to the server. When the route is not 0 I am getting the following response from the server {"status": 201} . Often the routes is 0 then

How can I detect long pressed volume and power button when app is in background on Android P using service

空扰寡人 提交于 2020-01-06 05:47:15
问题 I want to detect volume button press when app is in background and even if device is locked I am working on android P, I was able to get long pressed volume button when app is in background but screen not locked using service and by getting Allow over other apps permission but it caused problem , when app is in background back button and keyboard are not working , I am able to open other apps like whatsapp but I can not type a message and can not back , Here is my code any please help .

AlarmManager stops running

隐身守侯 提交于 2020-01-06 05:36:28
问题 I'm writing a program that should run every 10 minutes in the background. The code I have seems to work fine as long as I'm actively using my phone, but after a long period of time, say overnight, the process seems to stop on it's own. When my program is running as it should I can view it under the "cached process" on my device, but then it will stop showing in the list after awhile. I was reading about WakefulIntentService and was wondering if I need to use that. As I understand it, it will

Now Playing Card

♀尐吖头ヾ 提交于 2020-01-05 20:31:14
问题 I need help about displaying the Now Playing Card in the Recommendations row. I read the post about it in the Android developers site, but that did not help me much. I have a service that streams the MP3 data without problems. I added the following code, but there's no Now Playing Card... @Override public void onCreate() { Log.i(TAG, "onCreate called"); mSession = new MediaSession(this, "MusicService"); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(MediaSession.FLAG

Now Playing Card

帅比萌擦擦* 提交于 2020-01-05 20:31:14
问题 I need help about displaying the Now Playing Card in the Recommendations row. I read the post about it in the Android developers site, but that did not help me much. I have a service that streams the MP3 data without problems. I added the following code, but there's no Now Playing Card... @Override public void onCreate() { Log.i(TAG, "onCreate called"); mSession = new MediaSession(this, "MusicService"); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(MediaSession.FLAG

Log not working (or seems to drop some lines)

给你一囗甜甜゛ 提交于 2020-01-05 04:27:05
问题 EDIT: A more honed version of this question, with a good answer, is at: Rather odd behaviour of Log EDIT: The (bizarre) solution is reported as an answer below. I have a service as part of an application which is running reasonably well, although there is an unusual bit of behaviour which I am trying to understand. To do this, I have been putting Log.d statement in various methods in classes to report state information at various points. All of these seem to be working (ie reporting the

Sticky Service not restarting after RAM full on Xiaomi / Huawei / Lava

落爺英雄遲暮 提交于 2020-01-04 05:59:51
问题 I have a Sticky Service and i'm stress testing the app by filling the phone's RAM. Once the RAM is full, the service is destroyed. Since it's a sticky service, it gets restarted automatically when the system has enough resources. But this happens only on stock android devices like Moto/Nexus. Devices like Xiaomi or Lava do not restart the sticky service, even on 5.1 Is anyone aware of such problems with heavily customized ROMs? Any workarounds to schedule a restart of my service when the

How do I make my full-screen overlay remain full-screen after orientation changes?

笑着哭i 提交于 2020-01-04 02:28:29
问题 I am making an app that creates tiny sprite animations that walk around your screen. I have a main activity, with a button "start service". This starts a service, which (in onCreate() ) creates a full-screen view and attaches it to the root window manager. This part works perfectly. It fills the screen, and you can leave the app, and the animations will still be visible over everything. The problem emerges when you rotate the device. Sprites have moved to the middle of the screen, but this is