Android :: Reregister Phone State Listener If Application Crashed

Nov 17, 2009

i've registered a PhoneStateListener in BOOT_COMPLETED receiver by using following call: tm.listen(new TestCallStateListener(), PhoneStateListener. LISTEN_ CALL _STATE); If the application crashes then system automatically unregisters the PhoneStateListener. Is there any mechanism of checking if particular PhoneStateLister is registered or not? Actually i'm thinking of starting a repeating service by AlarmManager which will check if PhoneStateListener is registered or not . And if it's not registered then service will register it again. Just a backup if application crashes. Is this a good approach or there is some better mechanism to make sure that PhoneStateListener is always registered even if application crashes ?

Android :: Reregister Phone State Listener if application crashed


Android :: Phone State Listener State Transitions

Feb 8, 2009

I'm a little confused by what I'm seeing with regards to phone state transitions via the PhoneStateListener. When I receive a call, this is what happens: (call comes in) RINGING -> IDLE (I pick up) OFFHOOK (I hang up) IDLE It's that first transition from RINGING to IDLE without any interaction from me (not ending the call, not answering the call) that confuses me. Do I really have to implement an idle counter to know that an incoming call has really ended? Seems like the reported phone state represents some sort of phone state that isn't the obvious one.Is this a bug or am I just not in tune with the paradigm here?

View 2 Replies View Related

Android :: Phone State Listener Memory Leak

Sep 8, 2009

There appears to be a leak when using PhoneStateListeners. The following code simply reigsters in onResume and unregisters in onPause a PhoneStateListener. Repeatedly launch then press BACK (so the app is finished & onDestory is called before the next launch) and the number of activities reported by meminfo will equal the number of launches. For instance, here is the output I get after launching (and finishing) 11 times in sequence:

dumpsys meminfo com.example.leak Currently running services: meminfo
DUMP OF SERVICE meminfo: Applications Memory Usage (kB): Uptime: 12204322 Realtime: 12204322

** MEMINFO in pid 1358 [com.example.leak] ** native dalvik other total size:
2648 3079 N/A 5727
allocated: 2604 2254 N/A 4858
free: 43 825 N/A 868
(Pss): 913 1305 1475 3693
(shared dirty): 1080 3864 568 5512
(priv dirty): 808 936 1056 2800

Objects Views: 77
ViewRoots: AppContexts: 12
Activities: 11
Assets: 2
AssetManagers: 2
Local Binders: 36
Proxy Binders: 21
Death Recipients: 0
OpenSSL Sockets: 0
SQL heap: 0
dbFiles: 0
numPagers: 0
inactivePageKB: 0
activePageKB: 0 #

Without the PhoneStateListener, the number of activities is always 1 no matter how many times the app is launched & finished. So, am I doing anything wrong here? Or is this a bug in the TelephonyManager?

Here's the code package com.example.leak;

import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.util.Log;
public class LeakExample extends Activity {
private class MyPhoneStateListener extends PhoneStateListener {
@Override public void onCallStateChanged(int state, String incomingNumber) {
if ((state == TelephonyManager.CALL_STATE_RINGING)
|| (state == TelephonyManager.CALL_STATE_OFFHOOK)) {
LeakExample.this.finish();
} } }
MyPhoneStateListener phone_listener = new MyPhoneStateListener();
TelephonyManager telMgr ;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
telMgr = (TelephonyManager) getSystemService (Context.TELEPHONY_SERVICE);
} @Override protected void onPause() { super.onPause();
telMgr.listen(phone_listener, PhoneStateListener.LISTEN_NONE);
} @Override protected void onResume() { super.onResume();
telMgr.listen(phone_listener, PhoneStateListener.LISTEN_CALL_STATE);
} @Override protected void onDestroy() { super.onDestroy();
Log.v("LEAK EXAMPLE", "onDestory");
}

View 3 Replies View Related

Android :: Telephony Manager & Phone State Listener

Sep 7, 2010

I would like to know what are the main differences between TelephonyManager and PhoneStateListener, because you can do (more or less) the same things with both. For example, you could create an incoming calls register implementing a broadcastreceiver and using TelephonyManger API or extending PhoneStateListener class and registering this new listener throughTelephonyManager . Case 1 - BroadcastReceiver (TelephonyManager)

View 13 Replies View Related

Android :: Notify Service From Phone State Listener

Mar 19, 2010

I have built an application that listen to call state changes, and I want to notify a service when the call_state became IDLE.All the components I have are functional, I just need to notify (not start) a service for this.What's the correct practice, maybe using AIDL? Because, in a PhoneStateListener, I can't bind to a service. Do I have to start an activity for that?

View 2 Replies View Related

Android :: Error With Listening To Phone State Listener In Service

Nov 11, 2009

I have a BroadcastReceiver that listens for the BOOT_COMPLETED, that part works I know because I disabled my phone listener and displayed a Toast within. That BroadcastReceiver is supposed to start a service, that also works. I run into Force Close issues when my service attempts to tell my TelephonyManager to listen. Any one have any ideas? Here is my code StartSeviceAtStartUp.java import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent;

View 3 Replies View Related

Android :: Phone State Listener Events Stop Receiving Sometime

Jan 21, 2010

My application process incoming/outgoing calls and shows some UI. So I use PhoneState Listener to listen changes such as CALL_STATE_IDLE , CALL_STATE_RINGING ,CALL_ STATE_ OFFHOOK. on receiving call to my BroacastReceiver for incoming/outgoing call. Most of the time things work properly. But sometimes my application does not receive events of Phone State Listener and hence it is not able to change/clear UI.From user feedback this typically occurs on HTC Hero. But I have came across this issue sometime on other devices also.My first guess is that android is killing my application in midway during call due to memory requirement. If so, is there any way to ensure that android does not my kill application under such situation .

View 1 Replies View Related

Android :: Application Crashed After Either Receive Phone Call

Oct 30, 2010

After I either receive a phone call or make one, (and other undocumented interruptions) my application gets a NullPointerException when resuming my activity. Can any explain to me where it is and/or how to fix it?now, pls help me to fix this problem, how do i handle phone call or SMS received or such kind of interruptions?

View 2 Replies View Related

Android :: Application Read Phone State And Identity?

Dec 6, 2009

Anyone know what providing an application access to "Phone calls: read phone state and identity" actually does?

View 5 Replies View Related

Android :: Application Installer Tells That My App Reads Phone State And Identity

Apr 18, 2010

I have a simple app with a surfaceview nothing special one would say. However when installing on my phone I get two warnings.
1 - Phone calls
- read phone state and identity
2 - Storage
- modify/delete SD card content.
My really is nothing more than a simple puzzle and I dont understand why I get these warnings.

View 2 Replies View Related

Android :: How To Find Place Where Application Crashed

Aug 31, 2010

How to find out line of code where application failed in Android? (without debugging just to see crash dump)

View 3 Replies View Related

Android :: Application Crashed For List Of Data / Image From Server

Jan 18, 2010

I am developing one application which fetches the list of data/images from the server and shows on to the device. When I change the orientation, press Back button after doing it for 4-5 times app gets crashed. I am handling orientation change within activity itself and not setting the new view.

[Code]

View 8 Replies View Related

Android :: How To Unregister Listener After Application Get Closed

Apr 28, 2010

I am writing an application that listens to phone calls and perform some tasks when phone call arrives. The Application contains one activity which includes 2 buttons 'Start' and 'Stop' (where starts register the listener and stops unregister it - see code below).

The problem starts when the application is closed ( onDestroy is called ). If the user pressed on the start button and exit from the application the listener still working (which is the expected behavior) but from now it is impossible to unregister the listener since launching new instance of the application create new instance of phoneListener.

My question is:

1.Is there better way to implement my requirement?

2.Can I save the phoneListener object and reload It on application creation?

CODE:........................

View 9 Replies View Related

Android :: Air Traffic Control Scanner / Listener Application

May 13, 2010

There are police scanner apps - looking for an ATC scanner/listener app?

View 1 Replies View Related

Android :: Registering OnClick Listener On Application Widget Button

May 15, 2010

I'm creating my first widget and ran into a snag. I have several buttons on this widget and need a way to register an onClick action for each of the buttons. So far I've only found examples where they start a configuration activity from a widget button. Does someone have example code on using buttons in home screen widgets?

View 4 Replies View Related

Android :: Trying Out An App / It Crashed Phone

May 15, 2010

I was trying out an app, I think it's called Continuous Photo and it completely crashed my phone. I can't turn it on. I plugged it into the wall to see if that would help and it made the sound that one would expect when it's charging and the home, menu, and return buttons all lit up, but not the screen. It's a brand new phone that I've only had for 4 days. Is the problem, that I tried to complete a function using the app, that I didn't have enough memory for? No matter what the reason is, how can I fix it? I'm freaking out here.

View 3 Replies View Related

Android :: Tabbed Application With Location Listener Implemented In TabActivity TabHost

Sep 25, 2010

I have an application that has a tabActivity and 3 tabs. all off the tabs use a location listener and work with locations. i implement onPause and onResume for every tab to remove and start listening for location accordingly. is this the right way to go? i had another idea to work with and that was implementing a location listener to the tabActivity and doing broadcasts to the child tabs with the location, but it seemed more complicated.

The problem with my current solution is that whenever i switch tab i lose the location i got in the previous and i cant use getlastknown location because i dont want the last location on start of the application.(does this make sense?) what can i do to solve this problem. a thing that will work better will be to have one variable that will hold the last location from the onLocationChanged and i can observe its changes and call methods onChange.

View 1 Replies View Related

Android :: Red Droid Crashed Phone / Need Another

Oct 12, 2010

Don't download Red Droid! aka Red Tube! I downloaded this application and it crashed my phone. Have to get another one.

View 5 Replies View Related

Android :: Phone Crashed Constantly After Froyo

Sep 21, 2010

Ever since Froyo, I cannot text, email, and my phone crashes constantly.

View 1 Replies View Related

Android :: How To Get BT State / Update Application?

Apr 24, 2009

At the moment I am trying to update my application to Android 1.5. In Android 1.1 I was able to detect the BT state with catching the following broadcasts: Code...

View 8 Replies View Related

Android :: Saving Application State?

Jan 11, 2010

I understand how to save an application's state by using SharedPreferences, onSavedInstanceState() & onRestoreInstanceState(), etc as outlined in a similar post ( http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state ), but how do I save the last activity?

To be more specific, my application starts up and goes to a login screen. Once a user logs in and navigates through several activities, lets say he or she leaves the app using the home button or in some other way. Next time the user starts the app, it will go back to the login screen and do a login again. Instead, I want the app to start up and go to the last activity that was on top of the stack when the user left the app in the previous session.

How is the last activity saved so that it can be restored on app startup?

View 3 Replies View Related

Android :: Saving State Of An Application?

Jul 5, 2010

Which of the following is/are appropriate for saving the state of an Android application?

a. Activity.onFreeze()
b. Activity.onPause()
c. Activity.onStop()
d. Activity.onDestroy()
e. Activity.onFinish()

View 2 Replies View Related

Android :: Save State In My Application

Jul 16, 2010

I am developing an android application in which,the first activity is that for Login. After successful authentication, user can see an activity with 4 Tabs. My problem is that when user taps on the home button,the application should terminate and when the user again starts my application, he should be able to see the Login screen again and after successful Login, user should be able to see the tab on which he was working before application terminated(i.e., save state for all the tabs).

View 3 Replies View Related

Android :: Save .app.Application State?

Aug 9, 2010

I've encountered a problem wile using my own subclass of android.app.Application. I have numerous activities in my application and I'm running a custom ROM which consumes quite a lot of memory. What happens is when I launch a third party activity (Camera) my Application is killed. My Application subclass stores vital data for the whole app so it can't work without it. android.app.Application doesn't have any methods for saving or restoring application state. Activity does have them but they are not suitable.

How to perform save/restore state on Application subclass?

UPDATE I've managed to do so by filling a Bundle obtained from onSaveInstanceState and restoring values in onCreate. But is there any better way?

View 1 Replies View Related

Android :: Application State When Home Pressed

Aug 11, 2010

Is android have application state, like background or front?I have a situation when need to update same data if app is coming to front.onRestart or onStart is not good idea, because this method fire when we come from another activity.

View 23 Replies View Related

Android :: Save Instance State Of My Application?

Jan 11, 2010

As a follow on from my question on sharing state between Activities, how can I save the instance state of my Application? Since Application does not extend Activity, there is no onSaveInstanceState method to override.

NB: In advance, this is not a duplicate. Despite its name, How do I save an Android application's state? relates to Activity state

View 1 Replies View Related

Android :: Save - Complex - Application State To Bundle

Apr 30, 2010

This is a bit complicated to explain (and my first post), so bear with me please: I am currently trying to figure out the best way of saving my application's state in a bundle on the onSaveInstanceState event (working on a game). My application's state is based on a "world" class which contains various objects. Among these objects there is a creature object which contains bitmaps (Bitmap object)(allowing me to draw the various sprites of the creature when it's walking with more flexibility and accessibility).

Bit of creature constructor Java:

CODE:.................

After looking around for a few hours I found that serializing the world object (and all its sub-objects) was an acceptable way of saving it in the bundle. Unfortunately it appears that we can't serialize bitmaps and considering they're a part of my "creature" I can't seem to see a workaround.

Here come my questions: 1- Am I doing something fundamentally wrong? (not supposed to save bitmaps in objects? supposed to handle bitmaps in a separate class which I don't pass on the bundle and reload my bitmaps when restoring the application? ...) 2- Is there another way of passing my "world" object into my bundle (would using Parcelable work?)

View 5 Replies View Related

Motorola Droid :: Phone Crashed Like 7 Times / Sort It Out?

Nov 13, 2009

I just got the droid today. It has crashed like 7 times. I will be playing around on it and it acts like it is getting overloaded and shuts off and restarts. anyone else with this problem? what could be causing this?

View 1 Replies View Related

Android :: Stopping And Starting Service Based On Application State

Oct 28, 2010

I have a Service which tracks the location of the user. Currently, the Service boots when the application starts and stops when the application terminates. Unfortunately, if users keep the application in the background, the Service never stops and drains battery.

I would like the Service to stop when my application is not in the foreground. I was hoping the Application class would let me Override onPause and onResume handlers, but it does not have them.

View 1 Replies View Related

Android :: Retain Application / Activity State Correct Approach?

Dec 22, 2009

I just read from internet to maintain the state of my application by overriding the onKeyDown function as given below. And set the launch mode of my activity as singleInstance. And it is working perfectly. Just want to know if it is correct approach. And how it is different from onSaveInstanceState.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved