Closed andrm closed 13 years ago
What version of Android does the Mot Milestone run?
It's Android 2.2. MOT admitted this version not stellar, so it is quite sluggish in close to everything. It's not CC's "fault" per se, I was just interested what reason there is for not using foreground. Thanks!
This is a real issue for me, I use CarCast on the train so I like to read stuff and listen to the music podcast in the background, from time to time CC will just disappear and won't even save a bookmark for the last second so I'll have to go and search for the location. The worst part is that the music stopped in the first place.
Looking through the code there is an attempt to start as a foreground service, how can I help debug this?
Are we using it correctly? The google code in the first link did a fair amount of indirection to support many versions of android
I haven't done any android development so far so I dont know. I do know that CC doesn't show any notification icon on my system even when it is playing so something is probably not happening properly.
A quick code review that you do call stopForegroundCompat() but you never call startForegroundCompat. There are still calls sprinkled around for setForeground(true/false) that is deprecated in later APIs (2.0 and up actually).
OK, I desprinkled the setforeground stuff. I committed these changes to Git. Can you test them http://jadn.com/cc.apk. thx
Oops.. I should at least try this first
OK, now the version at http://jadn.com/cc.apk runs... can you try it out?
Still no notification icon upon playing, does it work for you? Do you see a notification icon?
I believe that calling the foreground task without a notification (a null notification) defeats the purpose, the idea from what I read so far is that there must be a notification icon for the user to know that something runs in the background.
I can't seem to install my own build of CC, this is the patch that is worth trying IMHO
$ git diff
diff --git a/cc/src/com/jadn/cc/services/ContentService.java b/cc/src/com/jadn/cc/services/ContentService.java
index adce0f1..c6daf0f 100644
--- a/cc/src/com/jadn/cc/services/ContentService.java
+++ b/cc/src/com/jadn/cc/services/ContentService.java
@@ -490,7 +490,9 @@ public class ContentService extends Service implements OnCompletionListener {
headsetReceiver = new HeadsetReceiver(this);
registerReceiver(headsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
- startForegroundCompat(0,null);
+ Notification notification = new Notification();
+ notification.icon = R.drawable.ccp_launcher;
+ startForegroundCompat(0, notification);
}
public void headsetStatusChanged(boolean headsetPresent) {
I managed to install and it crashees, I have no USB cable to debug so it will have to wait for next week.
The lastest update shows the icon for foreground mode. This should fix the issue, I'm closing it. Thanks!
Hi,
thanks for carcast, I'm using it everyday. Is there a reason why you don't use the android foreground mode? I have a Mot Milestone (Droid) which is a bit underpowered and if there is a lot happening on the device (navigation + general sync) sometimes CC gets stuttery or gets killed. There is the "Foreground mode" for apps in Android to improve scheduling for the app and avoid getting killed, specifically for things like music players. http://developer.android.com/reference/android/app/Service.html#startForeground%28int,%20android.app.Notification%29
Andreas.