Android :: Why Doesn't Context.bindService() Call OnStartCommand()?
Oct 22, 2010
Here is what the SDK doc says about the bindService():
"Clients can also use Context.bindService() to obtain a persistent connection to a service. This likewise creates the service if it is not already running (calling onCreate() while doing so), but does not call onStartCommand()."
This means that the Service creation lifecyle events are different depending on whether or not the service is created out of startService() or bindService(). Why such difference?
View 6 Replies
Mar 5, 2010
I am writing an android 1.5 application which starts just after boot-up. This is a service and should take a picture without preview. This app will log the light density in some areas whatever. I was able to take a picture but the picture was black.
After googling like crazy, i came across a bug thread about it. If you don't generate a preview, the image will be black since android camera needs preview to setup exposure and focus. I've created a surfaceview and listener but the onSurfaceCreated event never gets fired.
I guess the reason is, the surface is not being created visually. I've also seen some examples of calling the camera statically with MediaStore.CAPTURE_OR_SOMETHING which takes a picture and saves in the desired folder with two lines of code but it doesn't take a picture too.
Do i need to use ipc and bindservice to call this function or do you have any suggestion to achieve my goal (taking a picture without preview) and if so, would you give me a small piece of code as example?
View 2 Replies
View Related
Sep 11, 2013
Basically, I'm unable to make a briefcase folder on my phone's SD card. I can make new folders, but I don't get the range of options that you would normally get when hovering your cursor over the "New" option (when opening the "New" context menu) when accessing my SD card via a usb cable plugged into the phone; I'm actually able to get the context menu when accessing the SD card by sticking it straight into the computer, but when it remains in my phone (and the phone's hooked up to the computer), I don't get the context menu.
Here's what I want:
Obviously, I can just use the SD card by plugging it directly into the computer, but it's inconvenient to take off the case, remove the back, etc. I'd rather just plug a USB cable directly into the phone. Why is my phone preventing me from getting that context menu when doing so though?
Samsung-SGH-I437
Android version 4.1.2
View 1 Replies
View Related
May 12, 2010
I have this code fragment: Code...
View 3 Replies
View Related
Nov 11, 2010
Sometimes I need to provide a Context object to call specific functions, such as
Intent intent = new Intent(context, MyClass.class);
in order to start a service
context.startService(intent);
Or, provide a Context object to do a query
Cursor cursor = context.managedQuery(uri, projection, null, null, null);
If this is done in a UI class which extends Activity, that's fine.
However, If I want to create my own utility class (a singleton) that doesn't extend anything and call these functions, I don't have necessary Context object. Now my workaround is to pass an activity reference while initializing the utility class and have that reference to call those functions. I'm wondering what's the correct way to do that. It should not be reasonable to have every class to extends Context so that it can call those functions.
View 2 Replies
View Related
May 24, 2010
I'm working through the 'notepad' tutorial given in the developer's guide: http://developer.android.com/guide/tutorials/notepad/index.html
For some reason, even when i'm using their solution files, the context menu does not come up with i 'click and hold' on a list entry.
The class extends ListActivity, and calls "registerForContextMenu(getListView());"
but I never see the context menu fire. Any idea what's wrong with it?
View 2 Replies
View Related
Aug 2, 2010
When I'm on a call and a 2nd call comes in, my phone doesn't ring or anything. Is there anyway to change this so that I know when I have a call waiting without having to look at the screen (which is usually pressed up against my ear)?
View 1 Replies
View Related
Mar 21, 2010
a service started by a broadcast receiver starts an activity. I want to make it possible for this activity to communicate back to the service. I have chosen to use AIDL to make it possible. Everything seems works good except for bindService() method called in onCreate() of the activity. bindService(), in fact, throws a null pointer exception because onServiceConnected() is never called while onBind() method of the service is. Anyway bindService() returns true.The service is obviously active because it starts the activity.I know that calling an activity from a service could sound strange, but unfortunately this is the only way to have speech recognition in a service.
View 4 Replies
View Related
May 2, 2010
I have so far found two bugs in Galaxo 1.6.3:
a) Speaker doesn't work in call (very weak). works well in ringtones etc.
b) Scrolling contacts by letter doesn't work.
Other than that this is a leap forward, especially with the overclock options!
Both bugs, as well as others, fixed in 1.6.3.1 update!
View 49 Replies
View Related
Nov 18, 2010
I start service by using:
private ServiceConnection _serviceConnection = new ServiceConnection() {...}
bindService(new Intent(this, MainService.class), _serviceConnection, Context.BIND_AUTO_CREATE);
I want to 'restart' the service. (Let's not argue why I want to do that)
I do that by:
unbindService(_serviceConnection);
// Do some initialization on service
bindService(new Intent(this, MainService.class), _serviceConnection, Context.BIND_AUTO_CREATE);
I noticed service doesn't die(onDestroy doesn't run) until I call next bindService();
So some static initialization I did on service got cleared by onDestroy() implementation.
Question: How do you make sure unbindService() will stop service (run onDestory()),
so that I could do initialization after and re-run bindService()?
View 3 Replies
View Related
Oct 8, 2009
The 1.5 AVD doesn't seem to follow the documentation in: http://developer.android.com/reference/android/app/SearchManager.html
which says it's enough to call onSearchRequested() to call the search activity. I need to call startSearch() to make it work. However, when I check the source code of Activity.java, onSearchRequested() does call startSearch().
This works in 1.6.
Is this a bug in 1.5, or did I miss something?
View 5 Replies
View Related
May 28, 2009
I have my G1 connected to a FM transmitter in my car with my bluetooth headset connected. Music has no problem going out the G1. A call comes in and I connect it. After I disconnect the call, the sound does not go out the adapter on the G1, but out the phone's speaker. Is there any setting to make sure the sound goes out the bottom adapter and not the phone's speaker?
View 2 Replies
View Related
Dec 2, 2009
As a newbie to Android development, I'm trying to do the basics and build a media player. It works fine in one activity, but I'm now moving the MediaPlayer stuff to a remote service so it can carry on after the activity is destroy. I've moved the necessary code to the service, left comments in the activity where I'll need to call service methods, implemented my AIDL and it all builds with no errors (Eclipse).
However, I'm totally stumped as to how to call IPC methods. Are there any simple and minimal examples with no fat - just the bare essentials?
As I'm using IPC methods, I don't need to use onStart() at all - right? (I intend to use LoadFile(File path), and then have public void considerDeath() { if (!isPlaying()) { MyService.stopSelf(); } } method called from activity.onDestroy )
/guide/developing/tools/aidl.html has multiple binders, but when I use the mSecondaryConnection portion, I get "MyService.Stub cannot be resolved"
I've tried http://www.anddev.org/remote%5Fservice%5Ftutorial-t8127.html which seems to confuse things by overloading methods.
I can't find anything by Mark Murphy either on the subject.
View 2 Replies
View Related
Jun 23, 2010
I have problems simulating call or sms since telnet or ddms perspective on eclipse. I'm connected to the device and some commands works (window scale,...)If i try to simulate a gsm call then everything seems ok but i haven't anything on my emulator (nor incoming call nor notification) then if i launch an "gsm list" command my inbound call is listed and i can cancel it the same thing occurs with sms send everything seems ok (return OK) but there is no notification on the emulator nor sms in inbox :-(
I'm using the sdk r06 on a windows xp machine. I try with fresh avd on different platform :-(
Important : it has worked so i know it can work, but i would like to know why it doesn't work now ! Using ddms i don't see any trace on the log view.
View 1 Replies
View Related
Mar 31, 2009
I have noticed that if my background service crashes the system will automatically restart the service after 5 seconds. This is great, but I have noticed that only the onCreate method gets called and not the onStart method. Does this mean the service is properly restarted or do I need to do something special in the onCreate method to make sure it is? I did have my initialisation logic in the onCreate method and my starting service logic in the onStart method but it looks like it will all have to be in the onCreate method.
View 2 Replies
View Related
Jun 5, 2010
not sure why but all of a sudden my speaker phone during a call doesn't work. cant hear them at all.
View 1 Replies
View Related
Oct 1, 2010
Even though the end call is over 2x the size of my finger, it doesnt seem to work no matter how many time i press it! (most of the time).
View 5 Replies
View Related
Nov 22, 2012
I ported paranoid android from the desire HD to the thunderbolt and almost everything works fine except for the mic and speaker during calls. I have tried everything I can think of with my limited knowledge and was putting this here to see if some more seasoned devs may provide some insight. I'm hoping like hell this isn't kernel related but I seriously doubt it is. Data works fine and so does mms/SMS. I did have to port the ril from our limited ics roms we have to get data.
View 7 Replies
View Related
Nov 22, 2010
My X10 key pad doesn't work while answering any call. I've tried re-installing the software and restrarted few times. Can't retrieve voice messages ...
View 15 Replies
View Related
Jan 24, 2010
I want to keep work events separate from home events, which I loaded onto the phone's Calender. I went ahead and downloaded the Calendar Pad for Android and it is really great. It went and synched with the Calendar app native to the device, which is find because i really like the UI.
But I need a separate calendar app for my work stuff. I don't want them on the same calendar (way too crowded).
Anyone know of an app that just "keeps to itself"? I searched and I couldn't find one.
View 1 Replies
View Related
Mar 5, 2010
I've searched and have been unable to find a solution to this problem. Actually its with my wife's phone, we both have Moments, mine works great but hers frequently (not all the time) doesn't shut off during phone calls. At first I thought she was just holding it strange but I have seen it for myself and its quite frustrating. The biggest issue is that its an intermittent problem so of course it never happens when at the Sprint store asking about replacing the phone. I did the recent update to the phone and it still does it. Any way to fix this short of getting a new one?
View 5 Replies
View Related
Jul 8, 2010
Im also having many problems after update to 2.1.
1. (and most annoying)- Black screen on incoming calls. Phone just freezes on black screen and I just cant answer the phone or do anything else for that matter. Just have to remove the back cover and battery.
2. lot less free memory after the update. using taskkiller but still- even after killing all non-system processes i have about 30MBs less memory
3. google maps, footprints, people, peep, stocks, gmail and some others keep opening by themselves, though ive killed the apps with appkiller.
4. so-many-mentioned lag on making calls. also. every-now-and-then while on call it makes another call to the same person and puts active one on hold...
5. does not recocnise some contacts and just shows their numbers when on in or outgoing call.
I've done several reeboots and also some hard resets on the device but still no use.Seriously concidering switching over to rooted ROM...
View 9 Replies
View Related
Oct 5, 2012
I've purchased Samsung Galaxy S GT-I9003 (Android 2.2) in the month of Dec'11, but due to certain reasons I could started using the phone for last two months.
I've tried more than 10 call recorders for my phone, but it didn't work. I found an application on Google Play which says "the application might not work with Samsung GT-I9003 due to lack of support". any working call recorder for my mobile? keeping in view the point that I'm new to android.
View 5 Replies
View Related
Jan 21, 2010
How can I launch a contextmenu from a contextmenu? I'm trying to replicate the MediaPlayer action that happens when you long click a song, then click "Add to playlist" in the resulting contextmenu. When you click that menu item, another contextmenu pops up with "Add to playlist" as the title, and "Current playlist", "New", and however-many-playlists-you-have defined after that.
View 4 Replies
View Related
Sep 16, 2009
So I made a discovery - my dialpad doesn't work during a call. Even if I bring it up via the softkeys, the numbers don't register a tap...anyone. else have this issue or is it just my phone?
View 49 Replies
View Related
May 28, 2010
I'm developing a GPS tracking software on android. I need IPC to control the service from different activities. So I decide to develop a remote service with AIDL.This wasn't a big problem but now it's always running into the methods of the interface and not into those of my service class. Maybe someone could help me?If i now try to call a method from an activity for example start(trackId) nothing happens. The binding is OK. When debugging it always runs into the startTracking() in the generated ITrackingServiceRemote.java file and not into my TrackingService class. Where is the problem? I can't find anything wrong.
View 1 Replies
View Related
Feb 11, 2010
I use Google Voice (love it) primarily because of it's visual voicemail on my Droid. I do have a Google Voice number, and I'm trying to decide whether to set the Droid app to "make calls using Google Voice" or not.
I have no problem with giving out a different number, and my placed calls seeing the GV number in caller ID.
My question is, does this affect how the call is actually connected, from a quality standpoint? I tired a call both ways, and the sound quality seemed a little bit different. But then, I am an obsessive compulsive weirdo.
Is there any difference in call quality or routing between making a native Verizon call and a Google Voice call on Droid? (Like, does Google voice actual use 3G to connect to Google server over the internetz, then place the phone call?)
View 3 Replies
View Related
Jul 19, 2010
I'm confused about the concept of the Context class. I see that it's a base class of Activity, but the Android docs also mentions the Context storing global information about the app environment. So in my app which has 3 activities, does that mean I have 3 distinct Context objects, or do they actually refer to 1 entity? Also, what is the lifetime of a Context object- does it live until the last component of this activity's process is garbage collected?
View 1 Replies
View Related
Nov 24, 2010
i have got a stupid question to ask. I created a custom ContextMenu. But when i call the menu, the menu displayed will also have the default menu added in. Is there anyway for the default ContextMenu not to appear as well?Code requested: @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
menu.setHeaderTitle("Recipients");
inflater.inflate(R.menu.menu_contacts, menu);
View 1 Replies
View Related
Jan 4, 2010
Is there a way to get the current Context instance by using a static method? I'm looking for that way because i hate saving the context instance each time it changes.
View 1 Replies
View Related