[android-developers] Can WAKE_LOCK be acquired in a Service?
I have included a uses-permission to WAKE_LOCK statement in the Android manifest file. if(checkCallingOrSelfPermission(permission.WAKE_LOCK) == PackageManager.PERMISSION_GRANTED) { Log.i("tag", "WAKE_LOCK permission granted"); } else { Log.i("tag", "WAKE_LOCK permission denied"); } The above code gives permission granted when run from the Activity, however, when run inside a Service, it gives permission denied. Is there any way to acquire a WAKE_LOCK inside a Service? Am I doing something wrong? Thanks so much. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] spurious WAKE_LOCK SecurityException?
I am very confused because I am getting a permission problem when I have clearly included: in the manifest. 01-21 15:43:44.318: ERROR/AndroidRuntime(806): java.lang.SecurityException: Neither user 10019 nor current process has android.permission.WAKE_LOCK. Has anyone else encountered this? - is there a work-around? Thanks much. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] problem acquiring a WakeLock
This code: PowerManager pm = (PowerManager) ftaContext.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock (PowerManager.PARTIAL_WAKE_LOCK, "My Tag"); wl.acquire(); with this permission: produces this exception: 01-19 18:50:13.961: ERROR/Mo_call_end2(18463): android.os.Parcel.readException(Parcel.java:1234) 01-19 18:50:13.961: ERROR/Mo_call_end2(18463): android.os.Parcel.readException(Parcel.java:1222) 01-19 18:50:13.961: ERROR/Mo_call_end2(18463): android.os.IPowerManager$Stub$Proxy.acquireWakeLock(IPowerManager.java: 160) 01-19 18:50:13.961: ERROR/Mo_call_end2(18463): android.os.PowerManager$WakeLock.acquire(PowerManager.java:228) 01-19 18:50:13.961: ERROR/Mo_call_end2(18463): qcom.cta.fta.fta_voice.FTACommand$DefaultPhoneThread.run (FTACommand.java:741) Any insights appreciated. Thanks much. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ACTION_ANSWER never answers the call - phone state stays RINGING..
The only thing that seems to work is the telnet technique: > telnet localhost 5554 > gsm accept 1234567 On Dec 11, 5:06 pm, dreamerBoy wrote: > code: > > try > { > // answer the phone > Intent myIntent = new Intent(Intent.ACTION_ANSWER); > myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP // > | Intent.FLAG_DEBUG_LOG_RESOLUTION // > | Intent.FLAG_FROM_BACKGROUND // > | Intent.FLAG_ACTIVITY_NEW_TASK).addCategory > (Intent.CATEGORY_DEFAULT); > context.startActivity(myIntent); > } > catch (Exception e) > { > cleanup(); > return; > } > > // May need this intent-filter stanza as well > // > // > // > // > > This is called from an ordinary ("raw") thread. I simulate an > incoming call with: > > > telnet localhost 5554 > > gsm call 1234567 > > Phone rings and rings but Answer Activity never picks up - phone state > never goes to OFF_HOOK. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: problem answering a call
I've reverted back to my telnet technique which does work in answering a call. The command is: "gsm accept thePhoneNumber". On Dec 11, 2:56 pm, dreamerBoy wrote: > I tried to add the incoming number, just like it works for outgoing > calls. The result is that it crashes as before. Can't find a > matching Activity for this Intent, basically. > > // Intent doesn't match anything - crashes > Uri parsedPhoneNumber = Uri.parse("tel:" + incomingNumber); > Intent myIntent = new Intent(Intent.ACTION_ANSWER, > parsedPhoneNumber); > > myIntent.setFlags( // > Intent.FLAG_ACTIVITY_SINGLE_TOP | // > Intent.FLAG_DEBUG_LOG_RESOLUTION | // > Intent.FLAG_ACTIVITY_CLEAR_TOP | // > Intent.FLAG_ACTIVITY_NEW_TASK | // will crash > without this > Intent.FLAG_FROM_BACKGROUND // > ).addCategory(Intent.CATEGORY_DEFAULT); > > On Dec 10, 6:03 pm, "Xavier Mathews" wrote: > > > You would think that ACTION _ ANSWER would work. Why does it keep ringing? > > > On 12/10/2008, dreamerBoy wrote: > > > > Of course, now,ACTION_ANSWERActivity doesn't do anything. It > > > doesn't pick up the phone. The phone state is still RINGING - sigh... > > > > Any thoughts are appreciated. > > > > On Dec 10, 3:53 pm, dreamerBoy wrote: > > >> I did an upgrade to SDK r2 but it appears to be a Manifest file > > >> problem: > > > >> > > >> > >> android:name="android.intent.action.ANSWER" /> > > >> > >> android:name="android.intent.category.DEFAULT" /> > > >> > > > >> appears to fix the crash. > > > >> On Dec 9, 6:04 pm, dreamerBoy wrote: > > > >> > code: > > > >> > try > > >> > { > > >> > // answer the phone > > >> > Intent myIntent = new Intent(Intent.ACTION_ANSWER); > > >> > myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP // > > >> > | Intent.FLAG_DEBUG_LOG_RESOLUTION // > > >> > | Intent.FLAG_FROM_BACKGROUND // > > >> > | Intent.FLAG_ACTIVITY_NEW_TASK); > > >> > ftaContext.startActivity(myIntent); > > >> > } > > >> > catch (Exception e) > > >> > { > > >> > cleanup(); > > >> > return; > > >> > } > > > >> > This is called from an ordinary ("raw") thread. I simulate an > > >> > incoming call with: > > > >> > > telnet localhost 5554 > > >> > > gsm call 1234567 > > > >> > result: > > > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Resolving type null > > >> > scheme null of intent Intent { action=android.intent.action.ANSWER > > >> > flags=0x300c } > > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Action list: > > >> > [ActivityIntentInfo{433df190 com.android.phone.InCallScreen}] > > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Matching against > > >> > filter ActivityIntentInfo{433df190 com.android.phone.InCallScreen} > > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Filter matched! > > >> > match=0x108000 > > >> > 12-09 17:50:26.731: WARN/IntentResolver(52): resolveIntent failed: > > >> > found match, but none with Intent.CATEGORY_DEFAULT > > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Final result list: > > >> > 12-09 17:50:26.731: INFO/ActivityManager(52): Starting activity: > > >> > Intent { action=android.intent.action.ANSWER flags=0x300c } > > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): error > > >> > answering call > > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > >> > android.app.Instrumentation.checkStartActivityResult > > >> > (Instrumentation.java:1472) > > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > >> > android.app.Instrumentation.execStartActivity(Instrumentation.java: > > >> > 1442) > > >> > 12-09 17:50:26.741:
[android-developers] ACTION_ANSWER never answers the call - phone state stays RINGING..
code: try { // answer the phone Intent myIntent = new Intent(Intent.ACTION_ANSWER); myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP // | Intent.FLAG_DEBUG_LOG_RESOLUTION // | Intent.FLAG_FROM_BACKGROUND // | Intent.FLAG_ACTIVITY_NEW_TASK).addCategory (Intent.CATEGORY_DEFAULT); context.startActivity(myIntent); } catch (Exception e) { cleanup(); return; } // May need this intent-filter stanza as well // // // // This is called from an ordinary ("raw") thread. I simulate an incoming call with: > telnet localhost 5554 > gsm call 1234567 Phone rings and rings but Answer Activity never picks up - phone state never goes to OFF_HOOK. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: problem answering a call
I tried to add the incoming number, just like it works for outgoing calls. The result is that it crashes as before. Can't find a matching Activity for this Intent, basically. // Intent doesn't match anything - crashes Uri parsedPhoneNumber = Uri.parse("tel:" + incomingNumber); Intent myIntent = new Intent(Intent.ACTION_ANSWER, parsedPhoneNumber); myIntent.setFlags( // Intent.FLAG_ACTIVITY_SINGLE_TOP | // Intent.FLAG_DEBUG_LOG_RESOLUTION | // Intent.FLAG_ACTIVITY_CLEAR_TOP | // Intent.FLAG_ACTIVITY_NEW_TASK | // will crash without this Intent.FLAG_FROM_BACKGROUND // ).addCategory(Intent.CATEGORY_DEFAULT); On Dec 10, 6:03 pm, "Xavier Mathews" wrote: > You would think that ACTION _ ANSWER would work. Why does it keep ringing? > > On 12/10/2008, dreamerBoy wrote: > > > > > > > Of course, now, ACTION_ANSWER Activity doesn't do anything. It > > doesn't pick up the phone. The phone state is still RINGING - sigh... > > > Any thoughts are appreciated. > > > On Dec 10, 3:53 pm, dreamerBoy wrote: > >> I did an upgrade to SDK r2 but it appears to be a Manifest file > >> problem: > > >> > >> >> android:name="android.intent.action.ANSWER" /> > >> >> android:name="android.intent.category.DEFAULT" /> > >> > > >> appears to fix the crash. > > >> On Dec 9, 6:04 pm, dreamerBoy wrote: > > >> > code: > > >> > try > >> > { > >> > // answer the phone > >> > Intent myIntent = new Intent(Intent.ACTION_ANSWER); > >> > myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP // > >> > | Intent.FLAG_DEBUG_LOG_RESOLUTION // > >> > | Intent.FLAG_FROM_BACKGROUND // > >> > | Intent.FLAG_ACTIVITY_NEW_TASK); > >> > ftaContext.startActivity(myIntent); > >> > } > >> > catch (Exception e) > >> > { > >> > cleanup(); > >> > return; > >> > } > > >> > This is called from an ordinary ("raw") thread. I simulate an > >> > incoming call with: > > >> > > telnet localhost 5554 > >> > > gsm call 1234567 > > >> > result: > > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Resolving type null > >> > scheme null of intent Intent { action=android.intent.action.ANSWER > >> > flags=0x300c } > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Action list: > >> > [ActivityIntentInfo{433df190 com.android.phone.InCallScreen}] > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Matching against > >> > filter ActivityIntentInfo{433df190 com.android.phone.InCallScreen} > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Filter matched! > >> > match=0x108000 > >> > 12-09 17:50:26.731: WARN/IntentResolver(52): resolveIntent failed: > >> > found match, but none with Intent.CATEGORY_DEFAULT > >> > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Final result list: > >> > 12-09 17:50:26.731: INFO/ActivityManager(52): Starting activity: > >> > Intent { action=android.intent.action.ANSWER flags=0x300c } > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): error > >> > answering call > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > >> > android.app.Instrumentation.checkStartActivityResult > >> > (Instrumentation.java:1472) > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > >> > android.app.Instrumentation.execStartActivity(Instrumentation.java: > >> > 1442) > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > >> > android.app.ApplicationContext.startActivity(ApplicationContext.java: > >> > 596) > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > >> > android.content.ContextWrapper.startActivity(ContextWrapper.java:236) > >> > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > >> > cta.fta.fta_voice.FTAvoiceCmdMt_call_setup.waitForResult > >> > (FTAvoiceCmdMt_call_setup.java:610) > >> > 12-09 17:50:26.741: E
[android-developers] Re: problem answering a call
Of course, now, ACTION_ANSWER Activity doesn't do anything. It doesn't pick up the phone. The phone state is still RINGING - sigh... Any thoughts are appreciated. On Dec 10, 3:53 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > I did an upgrade to SDK r2 but it appears to be a Manifest file > problem: > > > android:name="android.intent.action.ANSWER" /> > android:name="android.intent.category.DEFAULT" /> > > > appears to fix the crash. > > On Dec 9, 6:04 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > > > code: > > > try > > { > > // answer the phone > > Intent myIntent = new Intent(Intent.ACTION_ANSWER); > > myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP // > > | Intent.FLAG_DEBUG_LOG_RESOLUTION // > > | Intent.FLAG_FROM_BACKGROUND // > > | Intent.FLAG_ACTIVITY_NEW_TASK); > > ftaContext.startActivity(myIntent); > > } > > catch (Exception e) > > { > > cleanup(); > > return; > > } > > > This is called from an ordinary ("raw") thread. I simulate an > > incoming call with: > > > > telnet localhost 5554 > > > gsm call 1234567 > > > result: > > > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Resolving type null > > scheme null of intent Intent { action=android.intent.action.ANSWER > > flags=0x300c } > > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Action list: > > [ActivityIntentInfo{433df190 com.android.phone.InCallScreen}] > > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Matching against > > filter ActivityIntentInfo{433df190 com.android.phone.InCallScreen} > > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Filter matched! > > match=0x108000 > > 12-09 17:50:26.731: WARN/IntentResolver(52): resolveIntent failed: > > found match, but none with Intent.CATEGORY_DEFAULT > > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Final result list: > > 12-09 17:50:26.731: INFO/ActivityManager(52): Starting activity: > > Intent { action=android.intent.action.ANSWER flags=0x300c } > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): error > > answering call > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > android.app.Instrumentation.checkStartActivityResult > > (Instrumentation.java:1472) > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > android.app.Instrumentation.execStartActivity(Instrumentation.java: > > 1442) > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > android.app.ApplicationContext.startActivity(ApplicationContext.java: > > 596) > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > android.content.ContextWrapper.startActivity(ContextWrapper.java:236) > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > cta.fta.fta_voice.FTAvoiceCmdMt_call_setup.waitForResult > > (FTAvoiceCmdMt_call_setup.java:610) > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > cta.fta.fta_voice.FTAvoiceCmdMt_call_setup.access$2 > > (FTAvoiceCmdMt_call_setup.java:508) > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > cta.fta.fta_voice.FTAvoiceCmdMt_call_setup$1.run > > (FTAvoiceCmdMt_call_setup.java:496) > > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > > java.lang.Thread.run(Thread.java:935) > > > Can anyone see what I'm doing wrong? > > > Thanks so much. > > > dreamer > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: problem answering a call
I did an upgrade to SDK r2 but it appears to be a Manifest file problem: appears to fix the crash. On Dec 9, 6:04 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > code: > > try > { > // answer the phone > Intent myIntent = new Intent(Intent.ACTION_ANSWER); > myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP // > | Intent.FLAG_DEBUG_LOG_RESOLUTION // > | Intent.FLAG_FROM_BACKGROUND // > | Intent.FLAG_ACTIVITY_NEW_TASK); > ftaContext.startActivity(myIntent); > } > catch (Exception e) > { > cleanup(); > return; > } > > This is called from an ordinary ("raw") thread. I simulate an > incoming call with: > > > telnet localhost 5554 > > gsm call 1234567 > > result: > > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Resolving type null > scheme null of intent Intent { action=android.intent.action.ANSWER > flags=0x300c } > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Action list: > [ActivityIntentInfo{433df190 com.android.phone.InCallScreen}] > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Matching against > filter ActivityIntentInfo{433df190 com.android.phone.InCallScreen} > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Filter matched! > match=0x108000 > 12-09 17:50:26.731: WARN/IntentResolver(52): resolveIntent failed: > found match, but none with Intent.CATEGORY_DEFAULT > 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Final result list: > 12-09 17:50:26.731: INFO/ActivityManager(52): Starting activity: > Intent { action=android.intent.action.ANSWER flags=0x300c } > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): error > answering call > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > android.app.Instrumentation.checkStartActivityResult > (Instrumentation.java:1472) > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > android.app.Instrumentation.execStartActivity(Instrumentation.java: > 1442) > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > android.app.ApplicationContext.startActivity(ApplicationContext.java: > 596) > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > android.content.ContextWrapper.startActivity(ContextWrapper.java:236) > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > cta.fta.fta_voice.FTAvoiceCmdMt_call_setup.waitForResult > (FTAvoiceCmdMt_call_setup.java:610) > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > cta.fta.fta_voice.FTAvoiceCmdMt_call_setup.access$2 > (FTAvoiceCmdMt_call_setup.java:508) > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > cta.fta.fta_voice.FTAvoiceCmdMt_call_setup$1.run > (FTAvoiceCmdMt_call_setup.java:496) > 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): > java.lang.Thread.run(Thread.java:935) > > Can anyone see what I'm doing wrong? > > Thanks so much. > > dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: new activity from PhoneStateListener callback method
You should be able to define your own constructor or setter that takes the context as a parameter, no? Does that not work? MyPhoneStateListener(Context ctx) { this.ctx = ctx; } or something - sthustfo wrote: > Hi, > > I would like to know how I can start a new activity from within the > PhoneStateListener method, say onCallStateChanged(). I do understand > that notifications must be used in general but since my test app deals > with voice call, I was thinking of starting an activity. > > public class MyPhoneStateListener extends PhoneStateListener { > public void onCallStateChanged(int state, String incomingNumber) > { > //Context context = this; > Log.d("test", incomingNumber); > > // context.startActivity(new Intent("com.test.DOSOMETHING")); > return; > } > } > > The problem is that in order to send an intent, I do not have the > 'context' available in the onCallStateChanged() method. > > In this case, how I can send an intent using startActivity? > > Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: new activity from PhoneStateListener callback method
You should be able to define your own constructor or setter that takes the context as a parameter, no? Does that not work? MyPhoneStateListener(Context ctx) { sthustfo wrote: > Hi, > > I would like to know how I can start a new activity from within the > PhoneStateListener method, say onCallStateChanged(). I do understand > that notifications must be used in general but since my test app deals > with voice call, I was thinking of starting an activity. > > public class MyPhoneStateListener extends PhoneStateListener { > public void onCallStateChanged(int state, String incomingNumber) > { > //Context context = this; > Log.d("test", incomingNumber); > > // context.startActivity(new Intent("com.test.DOSOMETHING")); > return; > } > } > > The problem is that in order to send an intent, I do not have the > 'context' available in the onCallStateChanged() method. > > In this case, how I can send an intent using startActivity? > > Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: new activity from PhoneStateListener callback method
You should be able to define your own constructor or setter that takes the context as a parameter, no? Does that not work? MyPhoneStateListener(Context ctx) { sthustfo wrote: > Hi, > > I would like to know how I can start a new activity from within the > PhoneStateListener method, say onCallStateChanged(). I do understand > that notifications must be used in general but since my test app deals > with voice call, I was thinking of starting an activity. > > public class MyPhoneStateListener extends PhoneStateListener { > public void onCallStateChanged(int state, String incomingNumber) > { > //Context context = this; > Log.d("test", incomingNumber); > > // context.startActivity(new Intent("com.test.DOSOMETHING")); > return; > } > } > > The problem is that in order to send an intent, I do not have the > 'context' available in the onCallStateChanged() method. > > In this case, how I can send an intent using startActivity? > > Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] problem answering a call
code: try { // answer the phone Intent myIntent = new Intent(Intent.ACTION_ANSWER); myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP // | Intent.FLAG_DEBUG_LOG_RESOLUTION // | Intent.FLAG_FROM_BACKGROUND // | Intent.FLAG_ACTIVITY_NEW_TASK); ftaContext.startActivity(myIntent); } catch (Exception e) { cleanup(); return; } This is called from an ordinary ("raw") thread. I simulate an incoming call with: > telnet localhost 5554 > gsm call 1234567 result: 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Resolving type null scheme null of intent Intent { action=android.intent.action.ANSWER flags=0x300c } 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Action list: [ActivityIntentInfo{433df190 com.android.phone.InCallScreen}] 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Matching against filter ActivityIntentInfo{433df190 com.android.phone.InCallScreen} 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Filter matched! match=0x108000 12-09 17:50:26.731: WARN/IntentResolver(52): resolveIntent failed: found match, but none with Intent.CATEGORY_DEFAULT 12-09 17:50:26.731: VERBOSE/IntentResolver(52): Final result list: 12-09 17:50:26.731: INFO/ActivityManager(52): Starting activity: Intent { action=android.intent.action.ANSWER flags=0x300c } 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): error answering call 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1472) 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): android.app.Instrumentation.execStartActivity(Instrumentation.java: 1442) 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): android.app.ApplicationContext.startActivity(ApplicationContext.java: 596) 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): android.content.ContextWrapper.startActivity(ContextWrapper.java:236) 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): cta.fta.fta_voice.FTAvoiceCmdMt_call_setup.waitForResult (FTAvoiceCmdMt_call_setup.java:610) 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): cta.fta.fta_voice.FTAvoiceCmdMt_call_setup.access$2 (FTAvoiceCmdMt_call_setup.java:508) 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): cta.fta.fta_voice.FTAvoiceCmdMt_call_setup$1.run (FTAvoiceCmdMt_call_setup.java:496) 12-09 17:50:26.741: ERROR/FTAvoiceCmdMt_call_setup3(32178): java.lang.Thread.run(Thread.java:935) Can anyone see what I'm doing wrong? Thanks so much. dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: invoking com.android.internal.*
Yes, I know about this URL and have downloaded much of the source code. The delicate problem is how to build in access to the internal classes that I need and have them be invoked correctly by Android. Question is, how to do this without in effect rolling your own version of Android i.e., doing a full build ... after all, (this probably includes Linux), there are 8 million lines of code in Android. This would likely turn into a project unto itself. I have an old android.jar from version 0.9 with the internal classes available. When I try to use that, the Eclipse aapt environment immediately figures out what I'm trying to do, fails my attempt, and gives me a snarky message saying that I'm going to have problems trying to do this. Monsieur Queru - any comment? Thanks dreamer On Dec 3, 10:10 am, Ash <[EMAIL PROTECTED]> wrote: > Use GIT to "checkout" the source code and add the internals paths you > need to your application. > > //android.git.kernel.org/platform/frameworks/base/telephony is what > you are looking for, I think. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: invoking com.android.internal.*
Yes, I know, I am a private implementer looking to write test applications for a hardware provider. On Dec 2, 5:33 pm, Jean-Baptiste Queru <[EMAIL PROTECTED]> wrote: > Those are private implementation/internal classes that aren't > supported for use by 3rd-party applications. > > JBQ > > On Tue, Dec 2, 2008 at 5:32 PM, dreamerBoy <[EMAIL PROTECTED]> wrote: > > > Does anyone know of a way to use classes in com.android.internal.* - > > e.g., com.android.internal.telephony.Call ? > > > There is sample code in the Android source code distribution. > > > My normal Eclipse-based Android development environment does not allow > > e.g., > > > import com.android.internal.telephony.Call; > > > Is there a special jar or something that can be downloaded? > > > Thanks much. > > > Paul > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] invoking com.android.internal.*
Does anyone know of a way to use classes in com.android.internal.* - e.g., com.android.internal.telephony.Call ? There is sample code in the Android source code distribution. My normal Eclipse-based Android development environment does not allow e.g., import com.android.internal.telephony.Call; Is there a special jar or something that can be downloaded? Thanks much. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to inject a KeyEvent
(LOG_TAG, "after phone state is " + phoneStateToString()); } } http://schemas.android.com/apk/res/android"; package="test.instTest" android:versionCode="1" android:versionName="1.0.0"> >adb shell am instrument -w -e class test.instTest.InstTest#testCall >test.instTest/android.test.InstrumentationTestRunner test.instTest.InstTest:. Test results for InstTest=. Time: 3.368 OK (1 test) On Nov 13, 4:37 pm, hackbod <[EMAIL PROTECTED]> wrote: > Fwiw, there has never been a public API to inject a key event, except > for the official API is on the Instrumentation class (which still > exists). As far as I know we don't right now have an API to get an > Instrumentation object when not running an instrumentation test, > though. > > I am a little confused about what you are asking -- you say that you > want to send an ENDCALL to end a call, but that this is inside of the > same application? I believe that if your app currently has focus, the > system will process that end call, though this is really not by > design, but is probably not a big deal (we decide whether it is okay > based on which window has focus so will be receiving the event... but > end call is special since it is intercepted by the system and never > delivered to the focused window). But if the user is in the in-call > screen, then that has focus, and you can't inject a key event since > you don't have focus. > > On Nov 13, 4:13 pm,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > I'm building a test application and I have to be able to hang up a > > call in an automated fashion. > > > It occurred to me that I might be able to inject a key event: > > > KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, > > KeyEvent.KEYCODE_ENDCALL ); > > > into the event queue somehow. > > > Apparently the last incarnation of the API had an injectKeyEvent() > > method in WindowManager but that's been stripped out. > > > Anyone know how to do it in 1.0? > > > Thanks much. > > > dreamer > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] ActivityInstrumentationTestCase issue - can't send key
The goal of this little test program is to launch initiate a call and then generate a press to the ENDCALL button. 1. It appears that I am incapable of unlocking the keyguard: 11-21 14:40:58.445: INFO/InstTest(209): after inKeyguardRestrictedInputMode() ? true 2. Then, Android tells me I don't have permission to send a key event: 11-21 14:41:00.173: WARN/WindowManager(53): Permission denied: injecting key event from pid 209 uid 10019 to window Window{43506808 com.android.phone/com.android.phone.InCallScreen} owned by uid 1001 EmptyActivity is just as it sounds - no additional code other than what Eclipse generates. If anyone can see something that is not being done correctly, I would very much appreciate their thoughts - Thanks - Paul package test.instTest; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.test.ActivityInstrumentationTestCase; import android.util.Log; import android.view.KeyEvent; import android.app.Instrumentation; import android.view.View; import android.content.IntentFilter; import android.app.Instrumentation.ActivityResult; import android.app.KeyguardManager; public class InstTest extends ActivityInstrumentationTestCase { private static final String LOG_TAG= "InstTest"; private TelephonyManagertelMgr; private Instrumentation instrumentation; private Context context; private KeyguardManager keyguardMgr; public InstTest() { super("test.instTest", EmptyActivity.class); } public void testPreconditions() { instrumentation = getInstrumentation(); assertTrue("Instrumentation must be non-null", instrumentation ! = null); context = instrumentation.getContext(); assertTrue("Context must be non-null", context != null); telMgr = (TelephonyManager) context.getSystemService (Context.TELEPHONY_SERVICE); assertTrue("TelephonyManager must be non-null", telMgr != null); keyguardMgr = (KeyguardManager) context.getSystemService (Context.KEYGUARD_SERVICE); assertTrue("KeyguardManager must be non-null", keyguardMgr != null); } public void testCall() { testPreconditions(); Log.i(LOG_TAG, "before inKeyguardRestrictedInputMode() ? " + keyguardMgr.inKeyguardRestrictedInputMode()); KeyguardManager.KeyguardLock keyguardLock = keyguardMgr.newKeyguardLock(LOG_TAG); keyguardLock.disableKeyguard(); Log.i(LOG_TAG, "after inKeyguardRestrictedInputMode() ? " + keyguardMgr.inKeyguardRestrictedInputMode()); IntentFilter intentFilter = new IntentFilter (Intent.ACTION_CALL); Uri parsedPhoneNumber = Uri.parse("tel:1234567"); Intent myIntent = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); Intent resultData = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); // myIntent = new Intent(Intent.ACTION_DIAL, parsedPhoneNumber); myIntent.setFlags(Intent.FLAG_DEBUG_LOG_RESOLUTION | Intent.FLAG_FROM_BACKGROUND | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); resultData.setFlags(Intent.FLAG_DEBUG_LOG_RESOLUTION | Intent.FLAG_FROM_BACKGROUND | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); Instrumentation.ActivityResult actResult = new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData); Instrumentation.ActivityMonitor actMonitor = new Instrumentation.ActivityMonitor(intentFilter, actResult, false); Log.i(LOG_TAG, "starting call."); instrumentation.waitForIdleSync(); context.startActivity(myIntent); instrumentation.waitForIdleSync(); Log.i(LOG_TAG, "number of hits from ActivityMonitor: " + actMonitor.getHits()); Activity phoneActivity = actMonitor.getLastActivity(); if (phoneActivity != null) Log.i(LOG_TAG, "phoneActivity is NOT NULL!!"); else Log.i(LOG_TAG, "phoneActivity is NULL"); Log.i(LOG_TAG, "before phone state is " + phoneStateToString()); Activity activity = getActivity(); Log.i(LOG_TAG, "activity class is " + activity.getClass()); View view = getActivity().getCurrentFocus(); if (view == null) Log.i(LOG_TAG, "Focus view is NULL"); else Log.i(LOG_TAG, "Focus view is NOT NULL"); Log.i(LOG_TAG, "Sending ENDCALL"); sendKeys(KeyEvent.KEYCODE_ENDCALL); instrumentation.waitForIdleSync(); Log.i(LOG_TAG, "Sent ENDCALL, sleeping"); sleep(1000); Log.i(LOG_TAG, "after phone state is " + phoneStateToString()); } } ~~ http://schemas.android.com/apk/res/android"; package="test.instTest" android:versionCode="1" android:versionName="1.0.0">
[android-developers] correct usage of "adb shell input"
Hi - I am wondering what the correct invocation of "adb shell input" is - It could be potentially very useful for me if I could inject key events into a running app. I've tried: > adb shell input keyevent KEYCODE_0 or > adb shell input keyevent KEYCODE_CALL etc. with an emulator running. I was inside the Dialer app and I was hoping that my numbers would show up. They do not. Neither the CALL or the ENDCALL buttons are clicked. I'm a little confused about the "adb shell input keyevent" syntax because it doesn't specify whether the action is UP or DOWN (or does it imply both a DOWN then an UP?). More often than not, I get something like: [1] Killed input keyevent CALL when I attempt to run "adb shell input keyevent .." In frustration, I tried "adb shell input keyevent 4" but this seemed to bounce me out of the dialer back to the menu. Can anyone shed some light as to whether I'm using this command correctly or if not, how and in what context it is intended to be used? Thanks so much. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: PhoneStateListener not called until Phone Activity completes...
I thinks I answered my own question again. The problem appears to be with the Android Service object. I was using an instance of the Service object to do my synchronization. In normal Java, when you call wait() inside of a synchronization block, the thread is supposed to release the monitor so that the thread can be notified ( ... because notify() must also be called from within a synchronization block.) It appears the Android Service object does not behave according to normal Java semantics i.e., it doesn't release the monitor when wait() is called. Therefore, notify() can't enter the monitor in order to wake up the thread and therefore, the wait always times out. The simple solution is to use another object as the synchronizer. I guess Service can be viewed as a special OS object with unique restrictions so it's understandable. However, this fact should definitely be placed in the documentation - yo Google. On Nov 17, 1:57 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > Hi - > > I'm having a problem with my PhoneStateListener not being called until > after the Phone Activity is finished. Here is what I am doing: > > step 1: Install a PhoneStateListener. The listener is supposed to > call notify() (synchronized on the lock object) when it detects a > change in the phone state (specifically OFF_HOOK). > > step 2: Place a call with the ACTION_CALL intent. > > step 3: Call wait(timeout) (in a synchronized loop), waiting for the > listener to wake us up. > > (I realize wait/notify can be tricky but am confident the > implementation is correct...) > > Step 3 is always appearing to time out even though I am seeing the > call go through properly on the emulator screen. No matter what > timeout value I use, it always times out even though > telephonyManager.getCallState() returns the correct value (OFF_HOOK). > > I tried placing step 2 and step 3 in their own, separate (ordinary > Java) threads. Same behavior. > > When I tried placing step 1 in its own (ordinary Java) thread, Android > throws: > > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): Uncaught handler: > thread Thread-9 exiting due to uncaught exception > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): > java.lang.RuntimeException: Can't create handler inside thread that > has not called Looper.prepare() > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > android.os.Handler.(Handler.java:111) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > android.telephony.PhoneStateListener$2.(PhoneStateListener.java: > 235) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > android.telephony.PhoneStateListener.(PhoneStateListener.java: > 234) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > test.phone.PhoneTestService$MyPhoneStateListener. > (PhoneTestService.java:529) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > test.phone.PhoneTestService$MyPhoneStateListener. > (PhoneTestService.java:529) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > test.phone.PhoneTestService.listenToCallState(PhoneTestService.java: > 640) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > test.phone.PhoneTestService.access$2(PhoneTestService.java:618) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > test.phone.PhoneTestService$1.run(PhoneTestService.java:704) > 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at > java.lang.Thread.run(Thread.java:935) > > Working on figuring out the right way to launch the listener in a > Handler thread - however, there's nothing in the PhoneStateListener > write-up about having to launch in a separate execution context. This > doesn't seem to follow Java orthodoxy either - e.g., in Swing, > callbacks are invoked seamlessly - no separate execution context > required. > > ...Unless - I've overlooked something ... > > Can anyone shed any light on this? > > Thanks much. > > -dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] PhoneStateListener not called until Phone Activity completes...
Hi - I'm having a problem with my PhoneStateListener not being called until after the Phone Activity is finished. Here is what I am doing: step 1: Install a PhoneStateListener. The listener is supposed to call notify() (synchronized on the lock object) when it detects a change in the phone state (specifically OFF_HOOK). step 2: Place a call with the ACTION_CALL intent. step 3: Call wait(timeout) (in a synchronized loop), waiting for the listener to wake us up. (I realize wait/notify can be tricky but am confident the implementation is correct...) Step 3 is always appearing to time out even though I am seeing the call go through properly on the emulator screen. No matter what timeout value I use, it always times out even though telephonyManager.getCallState() returns the correct value (OFF_HOOK). I tried placing step 2 and step 3 in their own, separate (ordinary Java) threads. Same behavior. When I tried placing step 1 in its own (ordinary Java) thread, Android throws: 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): Uncaught handler: thread Thread-9 exiting due to uncaught exception 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at android.os.Handler.(Handler.java:111) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at android.telephony.PhoneStateListener$2.(PhoneStateListener.java: 235) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at android.telephony.PhoneStateListener.(PhoneStateListener.java: 234) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at test.phone.PhoneTestService$MyPhoneStateListener. (PhoneTestService.java:529) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at test.phone.PhoneTestService$MyPhoneStateListener. (PhoneTestService.java:529) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at test.phone.PhoneTestService.listenToCallState(PhoneTestService.java: 640) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at test.phone.PhoneTestService.access$2(PhoneTestService.java:618) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at test.phone.PhoneTestService$1.run(PhoneTestService.java:704) 11-17 12:12:01.451: ERROR/AndroidRuntime(2004): at java.lang.Thread.run(Thread.java:935) Working on figuring out the right way to launch the listener in a Handler thread - however, there's nothing in the PhoneStateListener write-up about having to launch in a separate execution context. This doesn't seem to follow Java orthodoxy either - e.g., in Swing, callbacks are invoked seamlessly - no separate execution context required. ...Unless - I've overlooked something ... Can anyone shed any light on this? Thanks much. -dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: PhoneStateListener not being called back
Answered my own question... telMgr.listen(myPhoneStateListener, TelephonyManager.CALL_STATE_IDLE | TelephonyManager.CALL_STATE_RINGING | TelephonyManager.CALL_STATE_OFFHOOK); is wrong. This is right: telMgr.list(myPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); of course - one still uses TelephoneManager.CALL_STATE_IDLE in onCallStateChangedChanged so it's a bit tricky. Hey Google, Java has enums yes? On Nov 13, 4:24 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > I didn't forget: > > uses-permission> > > On Nov 13, 4:09 pm,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > private class MyPhoneStateListener extends PhoneStateListener > > { > > public void onCallStateChanged(int state, String incomingNumber) > > { > > log("listener call state: " + phoneStateToString(state) + " " > > + new Date()); > > } > > } > > > MyPhoneStateListener myPhoneStateListener = new MyPhoneStateListener > > (); > > /* > > * telMgr.listen(myPhoneStateListener, > > TelephonyManager.CALL_STATE_IDLE > > * | TelephonyManager.CALL_STATE_RINGING | > > * TelephonyManager.CALL_STATE_OFFHOOK); > > */ > > // let's try this... > > telMgr.listen(myPhoneStateListener, > > TelephonyManager.CALL_STATE_IDLE); > > > telMgr.listen(myPhoneStateListener, > > TelephonyManager.CALL_STATE_RINGING); > > > telMgr.listen(myPhoneStateListener, > > TelephonyManager.CALL_STATE_OFFHOOK); > > > Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel: > > 1234567")); > > thisActivity.startActivity(myIntent); > > > I can see the call definitely get placed on the emulator - however, no > > PhoneStateListener callback. > > > I can always resort to polling with > > > telMgr.getCallState() > > > but it's not as elegant as a callback - anyway, wondering what's up. > > > -dreamer > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to inject a KeyEvent
Hi Hackbod - sorry if I wasn't clear. This application is to be run in a COMPLETELY AUTOMATED mode - no humans clicking on anything. No humans at all - launch the app and review the results - that's it. (It's more of a test application than a consumer application.) What gave me hope is that there was an injectKeyEvent method on WindowManager in the last API release. See: http://www.anddev.org/throwing-simulating_keystrokes_programatically-t717.html I've tried killing the ACTION_CALL activity with finishActivity but it doesn't work. The system just ignores the request. Perhaps there is another way to hang up a call in an automated way. dreamer On Nov 13, 4:37 pm, hackbod <[EMAIL PROTECTED]> wrote: > Fwiw, there has never been a public API to inject a key event, except > for the official API is on the Instrumentation class (which still > exists). As far as I know we don't right now have an API to get an > Instrumentation object when not running an instrumentation test, > though. > > I am a little confused about what you are asking -- you say that you > want to send an ENDCALL to end a call, but that this is inside of the > same application? I believe that if your app currently has focus, the > system will process that end call, though this is really not by > design, but is probably not a big deal (we decide whether it is okay > based on which window has focus so will be receiving the event... but > end call is special since it is intercepted by the system and never > delivered to the focused window). But if the user is in the in-call > screen, then that has focus, and you can't inject a key event since > you don't have focus. > > On Nov 13, 4:13 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > > > I'm building a test application and I have to be able to hang up a > > call in an automated fashion. > > > It occurred to me that I might be able to inject a key event: > > > KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, > > KeyEvent.KEYCODE_ENDCALL ); > > > into the event queue somehow. > > > Apparently the last incarnation of the API had an injectKeyEvent() > > method in WindowManager but that's been stripped out. > > > Anyone know how to do it in 1.0? > > > Thanks much. > > > dreamer > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: PhoneStateListener not being called back
I didn't forget: On Nov 13, 4:09 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > private class MyPhoneStateListener extends PhoneStateListener > { > public void onCallStateChanged(int state, String incomingNumber) > { > log("listener call state: " + phoneStateToString(state) + " " > + new Date()); > } > } > > MyPhoneStateListener myPhoneStateListener = new MyPhoneStateListener > (); > /* > * telMgr.listen(myPhoneStateListener, > TelephonyManager.CALL_STATE_IDLE > * | TelephonyManager.CALL_STATE_RINGING | > * TelephonyManager.CALL_STATE_OFFHOOK); > */ > // let's try this... > telMgr.listen(myPhoneStateListener, > TelephonyManager.CALL_STATE_IDLE); > > telMgr.listen(myPhoneStateListener, > TelephonyManager.CALL_STATE_RINGING); > > telMgr.listen(myPhoneStateListener, > TelephonyManager.CALL_STATE_OFFHOOK); > > Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel: > 1234567")); > thisActivity.startActivity(myIntent); > > I can see the call definitely get placed on the emulator - however, no > PhoneStateListener callback. > > I can always resort to polling with > > telMgr.getCallState() > > but it's not as elegant as a callback - anyway, wondering what's up. > > -dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to inject a KeyEvent
Note that the key event injection is inside the SAME application. I am NOT trying to contact a foreign application to simulate e.g., user behavior. Hackbod was going on about InstrumentationTestCase to handle that situation but I don't think that this case is from the same mold (application contacting a foreign application). On Nov 13, 4:13 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > I'm building a test application and I have to be able to hang up a > call in an automated fashion. > > It occurred to me that I might be able to inject a key event: > > KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, > KeyEvent.KEYCODE_ENDCALL ); > > into the event queue somehow. > > Apparently the last incarnation of the API had an injectKeyEvent() > method in WindowManager but that's been stripped out. > > Anyone know how to do it in 1.0? > > Thanks much. > > dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] how to inject a KeyEvent
I'm building a test application and I have to be able to hang up a call in an automated fashion. It occurred to me that I might be able to inject a key event: KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENDCALL ); into the event queue somehow. Apparently the last incarnation of the API had an injectKeyEvent() method in WindowManager but that's been stripped out. Anyone know how to do it in 1.0? Thanks much. dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] PhoneStateListener not being called back
private class MyPhoneStateListener extends PhoneStateListener { public void onCallStateChanged(int state, String incomingNumber) { log("listener call state: " + phoneStateToString(state) + " " + new Date()); } } MyPhoneStateListener myPhoneStateListener = new MyPhoneStateListener (); /* * telMgr.listen(myPhoneStateListener, TelephonyManager.CALL_STATE_IDLE * | TelephonyManager.CALL_STATE_RINGING | * TelephonyManager.CALL_STATE_OFFHOOK); */ // let's try this... telMgr.listen(myPhoneStateListener, TelephonyManager.CALL_STATE_IDLE); telMgr.listen(myPhoneStateListener, TelephonyManager.CALL_STATE_RINGING); telMgr.listen(myPhoneStateListener, TelephonyManager.CALL_STATE_OFFHOOK); Intent myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel: 1234567")); thisActivity.startActivity(myIntent); I can see the call definitely get placed on the emulator - however, no PhoneStateListener callback. I can always resort to polling with telMgr.getCallState() but it's not as elegant as a callback - anyway, wondering what's up. -dreamer --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Oh - forgot to mention. The PhoneStateListener is still not working for me - I was originally doing a wait/notify on the state I needed. I changed the logic to a polling style which is not as elegant but will work in a pinch. On Nov 12, 12:00 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > dreamerBoywrote: > > Uri parsedPhoneNumber = Uri.parse("tel:1234567"); > > Intent myIntent = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); > > Activity myPhoneTestActivity = new Activity(); > > Don't do that third line. I'm surprised it even works -- I guess > Activity isn't an abstract superclass like I would have expected. > > > myPhoneTestActivity.startActivityForResult(myIntent, > > CALL_SETUP_ACTIVITY_ID); <== Crashes here, NullPointer > > Use your already-existing Activity, the one with the button. > > > Thus, the ACTION_CALL is now being launched as a sub-Activity. > > The behavior of this code inside an Activity is the same as it is > > inside a Service - it crashes at the same place with a > > NullPointerException (null mInstrumentation). > > Correct. myPhoneTestActivity isn't created by the Android framework. > > It may be easier to think of Activity as being a plug-in to Android more > so than a "program" in the traditional sense. Most plug-in frameworks > don't give you fully-working plugins just by instantiating them. > Instead, the plugins need to be wired into the overall system, code that > frequently is done by whoever is launching the plugin itself, outside > the bounds of the plugin's own constructors or callbacks. > > > I'm attempting to launch this new Activity with the ACTION_CALL Intent > > and Android does not ~appear~ anyway, to know what to do with it. If > > that theory is true, then no wonder the Activity is crashing... > > I've only tried ACTION_DIAL recently. > > However, it seems to work for this person: > > http://www.androiddevelopment.org/2008/10/21/android-development-demo... > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, > 2009http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
OK - I invoked ACTION_CALL using startActivityForResult(Intent, MY_ID). I then called finishActivity(MY_ID) - that should have killed the ACTION_CALL Activity created by the system. However, I can confirm that it does not. My next brainwave was to generate a keypress on the hang-up button - WindowManager wMgr = (WindowManager) getSystemService (Context.WINDOW_SERVICE); KeyEvent keyEvent = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENDCALL ); However, WindowManager seems to have lost its injectKeyEvent() method so I'm again... scratching my head. hackbod was going on about using InstrumentationTestCase to generate key events but that was for a foreign application - acting as an outside user so-to-speak. I only need key presses generated in the SAME application destined for the SAME application. Anyway - thanks for the push in the right direction - if you have any more insights, I thank you in advance... Paul On Nov 12, 12:00 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > dreamerBoywrote: > > Uri parsedPhoneNumber = Uri.parse("tel:1234567"); > > Intent myIntent = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); > > Activity myPhoneTestActivity = new Activity(); > > Don't do that third line. I'm surprised it even works -- I guess > Activity isn't an abstract superclass like I would have expected. > > > myPhoneTestActivity.startActivityForResult(myIntent, > > CALL_SETUP_ACTIVITY_ID); <== Crashes here, NullPointer > > Use your already-existing Activity, the one with the button. > > > Thus, the ACTION_CALL is now being launched as a sub-Activity. > > The behavior of this code inside an Activity is the same as it is > > inside a Service - it crashes at the same place with a > > NullPointerException (null mInstrumentation). > > Correct. myPhoneTestActivity isn't created by the Android framework. > > It may be easier to think of Activity as being a plug-in to Android more > so than a "program" in the traditional sense. Most plug-in frameworks > don't give you fully-working plugins just by instantiating them. > Instead, the plugins need to be wired into the overall system, code that > frequently is done by whoever is launching the plugin itself, outside > the bounds of the plugin's own constructors or callbacks. > > > I'm attempting to launch this new Activity with the ACTION_CALL Intent > > and Android does not ~appear~ anyway, to know what to do with it. If > > that theory is true, then no wonder the Activity is crashing... > > I've only tried ACTION_DIAL recently. > > However, it seems to work for this person: > > http://www.androiddevelopment.org/2008/10/21/android-development-demo... > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, > 2009http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Hi Mark - Yes, thank you for that - ~so~ much better. Call starts, screen changes.. ooh aah. However, still some issues - Right off, PhoneStateListener callback isn't being invoked for one. Still analyzing the logCat... Frustrating for me that the API is so coy about what is a Thread, what is a Process etc. I feel as though I need to know what I'm dealing with. I would like to at least attempt to call finish on the OutgoingCallBroadcaster activity to see if it hangs up the call. The problem now is to try to get a reference to it if that is possible. Looking at ActivityManager and RunningTaskInfo ... Paul On Nov 12, 12:00 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > dreamerBoywrote: > > Uri parsedPhoneNumber = Uri.parse("tel:1234567"); > > Intent myIntent = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); > > Activity myPhoneTestActivity = new Activity(); > > Don't do that third line. I'm surprised it even works -- I guess > Activity isn't an abstract superclass like I would have expected. > > > myPhoneTestActivity.startActivityForResult(myIntent, > > CALL_SETUP_ACTIVITY_ID); <== Crashes here, NullPointer > > Use your already-existing Activity, the one with the button. > > > Thus, the ACTION_CALL is now being launched as a sub-Activity. > > The behavior of this code inside an Activity is the same as it is > > inside a Service - it crashes at the same place with a > > NullPointerException (null mInstrumentation). > > Correct. myPhoneTestActivity isn't created by the Android framework. > > It may be easier to think of Activity as being a plug-in to Android more > so than a "program" in the traditional sense. Most plug-in frameworks > don't give you fully-working plugins just by instantiating them. > Instead, the plugins need to be wired into the overall system, code that > frequently is done by whoever is launching the plugin itself, outside > the bounds of the plugin's own constructors or callbacks. > > > I'm attempting to launch this new Activity with the ACTION_CALL Intent > > and Android does not ~appear~ anyway, to know what to do with it. If > > that theory is true, then no wonder the Activity is crashing... > > I've only tried ACTION_DIAL recently. > > However, it seems to work for this person: > > http://www.androiddevelopment.org/2008/10/21/android-development-demo... > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, > 2009http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
New Approach ... I have a "Hello, World"-type program. Basically all I do is say "Hello, World", install a useless button with a button-handler (to forestall ANR a little), and then I attempt to make a call with the ACTION_CALL Intent. I am no longer attempting to start the ACTION_CALL Activity from a Service! I invoke the following statements inside the onResume() method of my main "Hello, World" activity: Uri parsedPhoneNumber = Uri.parse("tel:1234567"); Intent myIntent = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); Activity myPhoneTestActivity = new Activity(); myPhoneTestActivity.startActivityForResult(myIntent, CALL_SETUP_ACTIVITY_ID); <== Crashes here, NullPointer Thus, the ACTION_CALL is now being launched as a sub-Activity. The behavior of this code inside an Activity is the same as it is inside a Service - it crashes at the same place with a NullPointerException (null mInstrumentation). Hackbod pointed out that the previous crash (mInstruction = null, according to Activity.java) was due to the fact that onCreate was not being called for the Activity. So I FAKED a call to onCreate(), to whit: Uri parsedPhoneNumber = Uri.parse("tel:1234567"); Intent myIntent = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); Activity myPhoneTestActivity = new Activity(); ==> myPhoneTestActivity.onCreate(); myPhoneTestActivity.startActivityForResult(myIntent, CALL_SETUP_ACTIVITY_ID); <== Still crashes here but different Of course, you're probably thinking that's not going to work and .. you'd be right! 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): Uncaught Exception Handler - thread: Thread[main,5,main] exception: android.app.ActivityThread.performResumeActivity(ActivityThread.java: 2504) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): android.app.ActivityThread.handleResumeActivity(ActivityThread.java: 2519) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2159) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): android.app.ActivityThread.access$1800(ActivityThread.java:112) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): android.os.Handler.dispatchMessage(Handler.java:88) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): android.os.Looper.loop(Looper.java:123) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): android.app.ActivityThread.main(ActivityThread.java:3742) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): java.lang.reflect.Method.invokeNative(Native Method) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): java.lang.reflect.Method.invoke(Method.java:515) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:739) 11-12 10:56:33.802: ERROR/test.phoneTest.PhoneTestActivity(1295): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 11-12 11:19:19.828: ERROR/test.phoneTest.PhoneTestActivity(309): dalvik.system.NativeStart.main(Native Method) Error appears to be more deeply entangled in Android's inner workings... I was curious about how the ACTION_CALL was handled so I started doing searches in the Android source code. > /bin/find . -name '*.java' -print | xargs grep ACTION_CALL Apparently, there is no code that handles this ... (checked the core classes as well as anything having to do with phones or telephony..) I'm asking myself now: Is ACTION_CALL implemented at all?? Is it implemented but just not in the Emulator?? I'm attempting to launch this new Activity with the ACTION_CALL Intent and Android does not ~appear~ anyway, to know what to do with it. If that theory is true, then no wonder the Activity is crashing... The other possibility of course, is that I am misunderstanding how to set this up correctly. http://schemas.android.com/apk/res/android"; package="test.phone" android:versionCode="1" android:versionName="1.0.0"> On Nov 10, 4:33 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > dreamerBoywrote: > > However, same error. > > I'm somewhat skeptical that launching an activity, particularly via > startActivityForResult(), will work from a service. I know it's in the > API, but think about what that means: some background process can cause > a full-fledged activity to spawn in front of the user, in the middle of > the user doing something else? That really violates the spirit of the UI > Android seems to be aiming for. > > Are you sure you want a service spawning this activity, instead of some > other activity doing
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Battle of the quotes, from: http://code.google.com/android/reference/android/app/Service.html "Other application components running in the same process as the service (such as an Activity) can, of course, increase the importance of the overall process beyond just the importance of the service itself. " This is like trying to interpret the Talmud or something... ;-) On Nov 10, 6:12 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > dreamerBoywrote: > > Thanks for the reply, Mark (I recognize the name - I read your book.) > > Thanks! > > > I am trying to place a call with the Activity that may - but need not, > > have any graphical UI aspect to it. Launching an Activity appears to > > be the only way to place a call in Android 1.0. If the thinking of > > the API is to disallow any calls being placed in an automated fashion, > > it seems to me that there would be no need for ACTION_CALL - only > > ACTION_DIAL. > > In the ACTION_CALL documentation, it states: > > "Note: there will be restrictions on which applications can initiate a > call; most applications should use the ACTION_DIAL." > > So even if you can get past the NullPointerException, you may still not > be able to place the call. > > Now, probably it will work, as there have been recent tutorials > demonstrating that it works from an activity, but I could see where this > might get locked down sometime in the future. > > > I am also wondering if there exists within the exposed Android API, a > > way to hang up a call in an automated fashion. No appropriate intents > > exist - it seems the only remaining possibility is calling finish() or > > finishActivity(ACTIVITY_ID) on the Activity used to place or answer > > the call. However, there is nothing in the docs which actually states > > that. If I can get past my currently difficulty, I will definitely > > test it. > > You could putter through the source code to see how the in-call > application handles it. Again, whatever technique it uses is probably > not for public consumption, your mileage may vary, do not taunt Happy > Fun Android, etc. > > > I'll be reconfiguring the program to see if I can get different > > results - perhaps I missed something simple in the Manifest. However, > > a NullPointerException really does merit some explanation. > > Well, hackbod took a guess, and her guesses are pretty damn good. > > Is whatever Context represented by initiateCall "real"? For example, if > initiateCall is some Activity you instantiated yourself as part of this > automated , that may not be fully-formed (i.e., gone through the normal > lifecycle) and therefore may not be able to start other activities. > > I hate to be the bearer of bad tidings, since you read my book and all > ;-), but I'm not terribly hopeful you'll be able to place a call, > initiated by some remote application, automatically, without user > intervention. > > Or, to put it another way, if it works, it'll scare the crap out of me, > because there's all sorts of nasty things one can do with that technique. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.4 Published! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Actually, thank you - you WERE correct - onCreate is NOT being called for this Activity. I tried doing a wait() for 5 - then 30 seconds on the onCreate callback being called - the wait timed out... Hmmm how to force an Activity to properly initialize itself. On Nov 10, 5:42 pm, hackbod <[EMAIL PROTECTED]> wrote: > Probably you are calling this before Activity.onCreate(), which is > where the mInstrumentation field is set. > > Note that calling into an activity from a Service like this is pretty > sketchy -- you will need to be very very careful about activity > lifecycle and updating the service as the activity changes. > > On Nov 10, 2:22 pm,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > Thanks for your reply - ha ha, wouldn't that be nice if it were that > > simple. Nope, I checked the return from the Uri.parse - not null. > > > I got a hold of the Android source code. It is crashing here in > > Activity.java: > > > public void startActivityForResult(Intent intent, int > > requestCode) { > > if (mParent == null) { > > Instrumentation.ActivityResult ar = > > ->>> mInstrumentation.execStartActivity( > > this, mMainThread.getApplicationThread(), mToken, > > th > > > intent, requestCode); > > > Apparently, mInstrumentation is null. > > mInstrumentation is set in a routine called attach in Activity.java. > > > I am trying to launch the Activity inside a Service - I don't see > > anything that says that's illegal. However, clearly, I'm not giving > > Android something that it wants. > > > Still scratching my head on this one for the time being... > > > On Nov 7, 6:10 pm, Chris <[EMAIL PROTECTED]> wrote: > > > > You don't check if Uri.parse returns null, do you? > > > > On Fri, Nov 7, 2008 at 3:53 PM,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I'm attempting to initiate an outgoing call from inside a Service. > > > > > In onStart(), I create an ACTION_CALL Intent, then attempt to start an > > > > Activity > > > > > myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + > > > > phoneNumber)); > > > > > initiateCall.startActivityForResult(myIntent, > > > > CALL_SETUP_ACTIVITY_ID); > > > > > However, when I run the code I get a NullPointerException. Clearly, > > > > the intent and activity are non-null, so I'm wondering what Android is > > > > lacking here. > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating > > > > initiateCall activity > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is NOT > > > > NULL! > > > > 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: > > > > CALL_STATE_IDLE > > > > 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen > > > > Fri Nov 07 13:24:19 PST 2008 > > > > 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call intent. > > > > 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is NOT > > > > NULL! > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): ERROR: > > > > java.lang.NullPointerException > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): > > > > java.lang.NullPointerException > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.Activity.startActivityForResult(Activity.java:2528) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > test.phone.PhoneTestService.doIt(PhoneTestService.java:254) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > test.phone.PhoneTestService.onStart(PhoneTestService.java:145) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2429) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread.access$3100(ActivityThread.java:112) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.Acti
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
On Nov 10, 6:12 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > dreamerBoywrote: > > Thanks for the reply, Mark (I recognize the name - I read your book.) > > In the ACTION_CALL documentation, it states: > > "Note: there will be restrictions on which applications can initiate a > call; most applications should use the ACTION_DIAL." Whoever wrote that sounds like a politician - lots of room to maneuver there - > > Now, probably it will work, as there have been recent tutorials > demonstrating that it works from an activity, but I could see where this > might get locked down sometime in the future. Ahhh - I miss the good ole days when there was something called a SecurityPolicy that one could customize ... > > > I am also wondering if there exists within the exposed Android API, a > > way to hang up a call in an automated fashion. No appropriate intents > > exist - it seems the only remaining possibility is calling finish() or > > finishActivity(ACTIVITY_ID) on the Activity used to place or answer > > the call. However, there is nothing in the docs which actually states > > that. If I can get past my currently difficulty, I will definitely > > test it. > > You could putter through the source code to see how the in-call > application handles it. Again, whatever technique it uses is probably > not for public consumption, your mileage may vary, do not taunt Happy > Fun Android, etc. I thought that Android was supposed to be about empowering developers to create new breeds of applications. > > > I'll be reconfiguring the program to see if I can get different > > results - perhaps I missed something simple in the Manifest. However, > > a NullPointerException really does merit some explanation. > > Well, hackbod took a guess, and her guesses are pretty damn good. According to my logCat readout - onCreate was already called a while back - time to drill in deeper I guess. I'm wondering why my attempt to install my own Instrumentation object doesn't appear to be working (at least, none of the lifecycle callbacks are talking to me). > > Is whatever Context represented by initiateCall "real"? For example, if > initiateCall is some Activity you instantiated yourself as part of this > automated , that may not be fully-formed (i.e., gone through the normal > lifecycle) and therefore may not be able to start other activities. Yep, it's possible that I got my life cycle out of order .. working on that - > > I hate to be the bearer of bad tidings, since you read my book and all > ;-), Actually your book, Haseman's book ("Android Essentials"), Gramlich's book ("Programming in Android"), and DiMarzio's book ("Programming in Android"). > but I'm not terribly hopeful you'll be able to place a call, > initiated by some remote application, automatically, without user > intervention. I could think of some quite useful applications that would utilize automated calling. Leave a voice or text message for a bunch o' people. Try to contact computer support or the IRS every 15 minutes - if someone actually picks up, then transfer the call to the user ... Yes, I suppose the latter capability could be used in a malicious way e.g., to stalk someone - however, there's something called a "Previous Number Dialed" button which can be used to do the same thing manually. > > Or, to put it another way, if it works, it'll scare the crap out of me, > because there's all sorts of nasty things one can do with that technique. > Yes, that situation already came up in the case of Applets ... download an Applet - it will steal your passwords, start emailing advertisements for erectile dysfunction cures, harass old ladies etc... See: http://www.securingjava.com/chapter-two/ Not saying you're wrong - Android designers may have indeed been afraid of this but if there are limitations they should be enumerated somehow - sigh. > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.4 Published! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Sorry... I should have checked my logCat ... in fact onCreate has already been called at the point where the NullPointerException is thrown. On Nov 10, 5:42 pm, hackbod <[EMAIL PROTECTED]> wrote: > Probably you are calling this before Activity.onCreate(), which is > where the mInstrumentation field is set. > > Note that calling into an activity from a Service like this is pretty > sketchy -- you will need to be very very careful about activity > lifecycle and updating the service as the activity changes. > > On Nov 10, 2:22 pm,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > Thanks for your reply - ha ha, wouldn't that be nice if it were that > > simple. Nope, I checked the return from the Uri.parse - not null. > > > I got a hold of the Android source code. It is crashing here in > > Activity.java: > > > public void startActivityForResult(Intent intent, int > > requestCode) { > > if (mParent == null) { > > Instrumentation.ActivityResult ar = > > ->>> mInstrumentation.execStartActivity( > > this, mMainThread.getApplicationThread(), mToken, > > th > > > intent, requestCode); > > > Apparently, mInstrumentation is null. > > mInstrumentation is set in a routine called attach in Activity.java. > > > I am trying to launch the Activity inside a Service - I don't see > > anything that says that's illegal. However, clearly, I'm not giving > > Android something that it wants. > > > Still scratching my head on this one for the time being... > > > On Nov 7, 6:10 pm, Chris <[EMAIL PROTECTED]> wrote: > > > > You don't check if Uri.parse returns null, do you? > > > > On Fri, Nov 7, 2008 at 3:53 PM,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I'm attempting to initiate an outgoing call from inside a Service. > > > > > In onStart(), I create an ACTION_CALL Intent, then attempt to start an > > > > Activity > > > > > myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + > > > > phoneNumber)); > > > > > initiateCall.startActivityForResult(myIntent, > > > > CALL_SETUP_ACTIVITY_ID); > > > > > However, when I run the code I get a NullPointerException. Clearly, > > > > the intent and activity are non-null, so I'm wondering what Android is > > > > lacking here. > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating > > > > initiateCall activity > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is NOT > > > > NULL! > > > > 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: > > > > CALL_STATE_IDLE > > > > 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen > > > > Fri Nov 07 13:24:19 PST 2008 > > > > 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call intent. > > > > 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is NOT > > > > NULL! > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): ERROR: > > > > java.lang.NullPointerException > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): > > > > java.lang.NullPointerException > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.Activity.startActivityForResult(Activity.java:2528) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > test.phone.PhoneTestService.doIt(PhoneTestService.java:254) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > test.phone.PhoneTestService.onStart(PhoneTestService.java:145) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2429) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread.access$3100(ActivityThread.java:112) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(125
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Hmmm... so perhaps I can call wait() or use some other kind of synchronizer until I get the proper onCreate callback. Thank you very much for that ... it's a start. On Nov 10, 5:42 pm, hackbod <[EMAIL PROTECTED]> wrote: > Probably you are calling this before Activity.onCreate(), which is > where the mInstrumentation field is set. > > Note that calling into an activity from a Service like this is pretty > sketchy -- you will need to be very very careful about activity > lifecycle and updating the service as the activity changes. > > On Nov 10, 2:22 pm,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > Thanks for your reply - ha ha, wouldn't that be nice if it were that > > simple. Nope, I checked the return from the Uri.parse - not null. > > > I got a hold of the Android source code. It is crashing here in > > Activity.java: > > > public void startActivityForResult(Intent intent, int > > requestCode) { > > if (mParent == null) { > > Instrumentation.ActivityResult ar = > > ->>> mInstrumentation.execStartActivity( > > this, mMainThread.getApplicationThread(), mToken, > > th > > > intent, requestCode); > > > Apparently, mInstrumentation is null. > > mInstrumentation is set in a routine called attach in Activity.java. > > > I am trying to launch the Activity inside a Service - I don't see > > anything that says that's illegal. However, clearly, I'm not giving > > Android something that it wants. > > > Still scratching my head on this one for the time being... > > > On Nov 7, 6:10 pm, Chris <[EMAIL PROTECTED]> wrote: > > > > You don't check if Uri.parse returns null, do you? > > > > On Fri, Nov 7, 2008 at 3:53 PM,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I'm attempting to initiate an outgoing call from inside a Service. > > > > > In onStart(), I create an ACTION_CALL Intent, then attempt to start an > > > > Activity > > > > > myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + > > > > phoneNumber)); > > > > > initiateCall.startActivityForResult(myIntent, > > > > CALL_SETUP_ACTIVITY_ID); > > > > > However, when I run the code I get a NullPointerException. Clearly, > > > > the intent and activity are non-null, so I'm wondering what Android is > > > > lacking here. > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating > > > > initiateCall activity > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is NOT > > > > NULL! > > > > 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: > > > > CALL_STATE_IDLE > > > > 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen > > > > Fri Nov 07 13:24:19 PST 2008 > > > > 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call intent. > > > > 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is NOT > > > > NULL! > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): ERROR: > > > > java.lang.NullPointerException > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): > > > > java.lang.NullPointerException > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.Activity.startActivityForResult(Activity.java:2528) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > test.phone.PhoneTestService.doIt(PhoneTestService.java:254) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > test.phone.PhoneTestService.onStart(PhoneTestService.java:145) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2429) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread.access$3100(ActivityThread.java:112) > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640) > > > > 11-07 13:24:21.632: ERROR/PhoneTestServic
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
initiateCall is just an Activity. Activity initiateCall = new Activity(); (actually a derived class of Activity with nothing added but debug statements to signal when each lifecycle/callback method is called). On Nov 10, 5:37 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > Hi - thank you for your reply. Yes, line 254 is just: > > initiateCall.startActivityForResult(myIntent, > CALL_SETUP_ACTIVITY_ID); > > That is the statement that throws the NullPointerException. > > On Nov 10, 4:28 pm, Christine <[EMAIL PROTECTED]> wrote: > > > Your log says that the error is in line 254 of PhoneTestService, if > > that's a class you wrote. > > > On Nov 11, 1:20 am,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > Taking a hint from the source code, I tried to implement an > > > Instrumentation class in the hopes that that was what Android was > > > looking for - > > > > Added: > > > > > > android:name=".PhoneTestInstrumentation"> > > > > and > > > > > > android:name="android.permission.RUN_INSTRUMENTATION"> > > permission> > > > > to the manifest. > > > > However, same error. > > > > On Nov 10, 2:22 pm,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > > Thanks for your reply - ha ha, wouldn't that be nice if it were that > > > > simple. Nope, I checked the return from the Uri.parse - not null. > > > > > I got a hold of the Android source code. It is crashing here in > > > > Activity.java: > > > > > public void startActivityForResult(Intent intent, int > > > > requestCode) { > > > > if (mParent == null) { > > > > Instrumentation.ActivityResult ar = > > > > ->>> mInstrumentation.execStartActivity( > > > > this, mMainThread.getApplicationThread(), mToken, > > > > th > > > > > intent, requestCode); > > > > > Apparently, mInstrumentation is null. > > > > mInstrumentation is set in a routine called attach in Activity.java. > > > > > I am trying to launch the Activity inside a Service - I don't see > > > > anything that says that's illegal. However, clearly, I'm not giving > > > > Android something that it wants. > > > > > Still scratching my head on this one for the time being... > > > > > On Nov 7, 6:10 pm, Chris <[EMAIL PROTECTED]> wrote: > > > > > > You don't check if Uri.parse returns null, do you? > > > > > > On Fri, Nov 7, 2008 at 3:53 PM,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > > > > > I'm attempting to initiate an outgoing call from inside a Service. > > > > > > > In onStart(), I create an ACTION_CALL Intent, then attempt to start > > > > > > an > > > > > > Activity > > > > > > > myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + > > > > > > phoneNumber)); > > > > > > > initiateCall.startActivityForResult(myIntent, > > > > > > CALL_SETUP_ACTIVITY_ID); > > > > > > > However, when I run the code I get a NullPointerException. Clearly, > > > > > > the intent and activity are non-null, so I'm wondering what Android > > > > > > is > > > > > > lacking here. > > > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called > > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called > > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called > > > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating > > > > > > initiateCall activity > > > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is > > > > > > NOT > > > > > > NULL! > > > > > > 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: > > > > > > CALL_STATE_IDLE > > > > > > 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen > > > > > > Fri Nov 07 13:24:19 PST 2008 > > > > > > 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call > > > > > > intent. > > > > > > 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is N
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Thanks for the reply, Mark (I recognize the name - I read your book.) I understand your reasonable argument. Unfortunately, the application I'm writing has a requirement that it be designed so that it is completely automated. It is not a true user application at all - more like a test application which maintains a socket connection to a driver program outside Android. I am trying to place a call with the Activity that may - but need not, have any graphical UI aspect to it. Launching an Activity appears to be the only way to place a call in Android 1.0. If the thinking of the API is to disallow any calls being placed in an automated fashion, it seems to me that there would be no need for ACTION_CALL - only ACTION_DIAL. I am also wondering if there exists within the exposed Android API, a way to hang up a call in an automated fashion. No appropriate intents exist - it seems the only remaining possibility is calling finish() or finishActivity(ACTIVITY_ID) on the Activity used to place or answer the call. However, there is nothing in the docs which actually states that. If I can get past my currently difficulty, I will definitely test it. I'll be reconfiguring the program to see if I can get different results - perhaps I missed something simple in the Manifest. However, a NullPointerException really does merit some explanation. Paul On Nov 10, 4:33 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > dreamerBoywrote: > > However, same error. > > I'm somewhat skeptical that launching an activity, particularly via > startActivityForResult(), will work from a service. I know it's in the > API, but think about what that means: some background process can cause > a full-fledged activity to spawn in front of the user, in the middle of > the user doing something else? That really violates the spirit of the UI > Android seems to be aiming for. > > Are you sure you want a service spawning this activity, instead of some > other activity doing it? Or maybe use Notifications or something? > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > > Android Training on the Ranch! -- Mar 16-20, > 2009http://www.bignerdranch.com/schedule.shtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Hi - thank you for your reply. Yes, line 254 is just: initiateCall.startActivityForResult(myIntent, CALL_SETUP_ACTIVITY_ID); That is the statement that throws the NullPointerException. On Nov 10, 4:28 pm, Christine <[EMAIL PROTECTED]> wrote: > Your log says that the error is in line 254 of PhoneTestService, if > that's a class you wrote. > > On Nov 11, 1:20 am,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > Taking a hint from the source code, I tried to implement an > > Instrumentation class in the hopes that that was what Android was > > looking for - > > > Added: > > > > android:name=".PhoneTestInstrumentation"> > > > and > > > > android:name="android.permission.RUN_INSTRUMENTATION"> > permission> > > > to the manifest. > > > However, same error. > > > On Nov 10, 2:22 pm,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > Thanks for your reply - ha ha, wouldn't that be nice if it were that > > > simple. Nope, I checked the return from the Uri.parse - not null. > > > > I got a hold of the Android source code. It is crashing here in > > > Activity.java: > > > > public void startActivityForResult(Intent intent, int > > > requestCode) { > > > if (mParent == null) { > > > Instrumentation.ActivityResult ar = > > > ->>> mInstrumentation.execStartActivity( > > > this, mMainThread.getApplicationThread(), mToken, > > > th > > > > intent, requestCode); > > > > Apparently, mInstrumentation is null. > > > mInstrumentation is set in a routine called attach in Activity.java. > > > > I am trying to launch the Activity inside a Service - I don't see > > > anything that says that's illegal. However, clearly, I'm not giving > > > Android something that it wants. > > > > Still scratching my head on this one for the time being... > > > > On Nov 7, 6:10 pm, Chris <[EMAIL PROTECTED]> wrote: > > > > > You don't check if Uri.parse returns null, do you? > > > > > On Fri, Nov 7, 2008 at 3:53 PM,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > > I'm attempting to initiate an outgoing call from inside a Service. > > > > > > In onStart(), I create an ACTION_CALL Intent, then attempt to start an > > > > > Activity > > > > > > myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + > > > > > phoneNumber)); > > > > > > initiateCall.startActivityForResult(myIntent, > > > > > CALL_SETUP_ACTIVITY_ID); > > > > > > However, when I run the code I get a NullPointerException. Clearly, > > > > > the intent and activity are non-null, so I'm wondering what Android is > > > > > lacking here. > > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called > > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called > > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating > > > > > initiateCall activity > > > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is NOT > > > > > NULL! > > > > > 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: > > > > > CALL_STATE_IDLE > > > > > 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen > > > > > Fri Nov 07 13:24:19 PST 2008 > > > > > 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call intent. > > > > > 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is NOT > > > > > NULL! > > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): ERROR: > > > > > java.lang.NullPointerException > > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): > > > > > java.lang.NullPointerException > > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > > android.app.Activity.startActivityForResult(Activity.java:2528) > > > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > > > test.phone.PhoneTestService.doIt(PhoneTestService.java:254) > > > > > 11-07 13:24:21.632: ERROR/PhoneTe
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Taking a hint from the source code, I tried to implement an Instrumentation class in the hopes that that was what Android was looking for - Added: and to the manifest. However, same error. On Nov 10, 2:22 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > Thanks for your reply - ha ha, wouldn't that be nice if it were that > simple. Nope, I checked the return from the Uri.parse - not null. > > I got a hold of the Android source code. It is crashing here in > Activity.java: > > public void startActivityForResult(Intent intent, int > requestCode) { > if (mParent == null) { > Instrumentation.ActivityResult ar = > ->>> mInstrumentation.execStartActivity( > this, mMainThread.getApplicationThread(), mToken, > th > > intent, requestCode); > > Apparently, mInstrumentation is null. > mInstrumentation is set in a routine called attach in Activity.java. > > I am trying to launch the Activity inside a Service - I don't see > anything that says that's illegal. However, clearly, I'm not giving > Android something that it wants. > > Still scratching my head on this one for the time being... > > On Nov 7, 6:10 pm, Chris <[EMAIL PROTECTED]> wrote: > > > You don't check if Uri.parse returns null, do you? > > > On Fri, Nov 7, 2008 at 3:53 PM,dreamerBoy<[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I'm attempting to initiate an outgoing call from inside a Service. > > > > In onStart(), I create an ACTION_CALL Intent, then attempt to start an > > > Activity > > > > myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + > > > phoneNumber)); > > > > initiateCall.startActivityForResult(myIntent, > > > CALL_SETUP_ACTIVITY_ID); > > > > However, when I run the code I get a NullPointerException. Clearly, > > > the intent and activity are non-null, so I'm wondering what Android is > > > lacking here. > > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating > > > initiateCall activity > > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is NOT > > > NULL! > > > 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: > > > CALL_STATE_IDLE > > > 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen > > > Fri Nov 07 13:24:19 PST 2008 > > > 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call intent. > > > 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is NOT > > > NULL! > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): ERROR: > > > java.lang.NullPointerException > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): > > > java.lang.NullPointerException > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > android.app.Activity.startActivityForResult(Activity.java:2528) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > test.phone.PhoneTestService.doIt(PhoneTestService.java:254) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > test.phone.PhoneTestService.onStart(PhoneTestService.java:145) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2429) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > android.app.ActivityThread.access$3100(ActivityThread.java:112) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > android.os.Handler.dispatchMessage(Handler.java:88) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > android.os.Looper.loop(Looper.java:123) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > android.app.ActivityThread.main(ActivityThread.java:3742) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > java.lang.reflect.Method.invokeNative(Native Method) > > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > > java.lang.reflect.Method.invoke(Method.java:515) > > > 11-07 13:24:21.632: ERROR
[android-developers] Re: problem obtaining android source from windows/cygwin
Fixed my own problem: Go to: http://android.git.kernel.org/ Depending on your particular interest, you may want other packages but you probably definitely want platform/frameworks/base.git Nota Bene: Do ~~NOT~~ go to: http://source.android.com/download Guaranteed, you will waste a few hours struggling with repo, Python, gnugp, key encryption and other things (ask me how I know). Paul On Nov 6, 12:40 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > bash-3.2$ /cygdrive/c/myRepo/repo init -u > git://android.git.kernel.org/platform/manifest.git > Traceback (most recent call last): > File "/cygdrive/c/myRepo/repo", line 587, in > main(sys.argv[1:]) > File "/cygdrive/c/myRepo/repo", line 554, in main > _Init(args) > File "/cygdrive/c/myRepo/repo", line 173, in _Init > _CheckGitVersion() > File "/cygdrive/c/myRepo/repo", line 202, in _CheckGitVersion > proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) > File "/cygdrive/c/cygwin/lib/python2.5/subprocess.py", line 593, in > __init__ > errread, errwrite) > File "/cygdrive/c/cygwin/lib/python2.5/subprocess.py", line 1079, in > _execute_ > child > raise child_exception > OSError: [Errno 2] No such file or directory > > I wouldn't describe myself as a Python guru. Has anyone been able to > overcome and fix this problem? > > Thanks much. > > Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Thanks for your reply - ha ha, wouldn't that be nice if it were that simple. Nope, I checked the return from the Uri.parse - not null. I got a hold of the Android source code. It is crashing here in Activity.java: public void startActivityForResult(Intent intent, int requestCode) { if (mParent == null) { Instrumentation.ActivityResult ar = ->>> mInstrumentation.execStartActivity( this, mMainThread.getApplicationThread(), mToken, th intent, requestCode); Apparently, mInstrumentation is null. mInstrumentation is set in a routine called attach in Activity.java. I am trying to launch the Activity inside a Service - I don't see anything that says that's illegal. However, clearly, I'm not giving Android something that it wants. Still scratching my head on this one for the time being... On Nov 7, 6:10 pm, Chris <[EMAIL PROTECTED]> wrote: > You don't check if Uri.parse returns null, do you? > > > > On Fri, Nov 7, 2008 at 3:53 PM, dreamerBoy <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I'm attempting to initiate an outgoing call from inside a Service. > > > In onStart(), I create an ACTION_CALL Intent, then attempt to start an > > Activity > > > myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + > > phoneNumber)); > > > initiateCall.startActivityForResult(myIntent, > > CALL_SETUP_ACTIVITY_ID); > > > However, when I run the code I get a NullPointerException. Clearly, > > the intent and activity are non-null, so I'm wondering what Android is > > lacking here. > > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called > > 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating > > initiateCall activity > > 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is NOT > > NULL! > > 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: > > CALL_STATE_IDLE > > 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen > > Fri Nov 07 13:24:19 PST 2008 > > 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call intent. > > 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is NOT > > NULL! > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): ERROR: > > java.lang.NullPointerException > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): > > java.lang.NullPointerException > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > android.app.Activity.startActivityForResult(Activity.java:2528) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > test.phone.PhoneTestService.doIt(PhoneTestService.java:254) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > test.phone.PhoneTestService.onStart(PhoneTestService.java:145) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2429) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > android.app.ActivityThread.access$3100(ActivityThread.java:112) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > android.os.Handler.dispatchMessage(Handler.java:88) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > android.os.Looper.loop(Looper.java:123) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > android.app.ActivityThread.main(ActivityThread.java:3742) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > java.lang.reflect.Method.invokeNative(Native Method) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > java.lang.reflect.Method.invoke(Method.java:515) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > com.android.internal.os.ZygoteInit > > $MethodAndArgsCaller.run(ZygoteInit.java:739) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) > > 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at > > dalvik.system.NativeStart.main(Native Method) > > > Don't know where to go from here... > > > > > http://schemas.android.com/apk/res/android"; > > package="test.phone" > > android:versionCode="1" > > android:versionName="1.0.0">
[android-developers] Head-scratcher: NullPointerException from startActivity(ACTION_CALL)
Hi, I'm attempting to initiate an outgoing call from inside a Service. In onStart(), I create an ACTION_CALL Intent, then attempt to start an Activity myIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber)); initiateCall.startActivityForResult(myIntent, CALL_SETUP_ACTIVITY_ID); However, when I run the code I get a NullPointerException. Clearly, the intent and activity are non-null, so I'm wondering what Android is lacking here. 11-07 13:24:19.801: INFO/PhoneTestService(1250): onCreate called 11-07 13:24:19.801: INFO/PhoneTestService(1250): onStart called 11-07 13:24:19.801: INFO/PhoneTestService(1250): doIt called 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): creating initiateCall activity 11-07 13:24:19.811: DEBUG/PhoneTestService(1250): initiateCall is NOT NULL! 11-07 13:24:19.820: INFO/PhoneTestService(1250): phone state is: CALL_STATE_IDLE 11-07 13:24:21.601: INFO/PhoneTestService(1250): starting to listen Fri Nov 07 13:24:19 PST 2008 11-07 13:24:21.622: INFO/PhoneTestService(1250): starting call intent. 11-07 13:24:21.622: DEBUG/PhoneTestService(1250): myIntent is NOT NULL! 11-07 13:24:21.632: ERROR/PhoneTestService(1250): ERROR: java.lang.NullPointerException 11-07 13:24:21.632: ERROR/PhoneTestService(1250): java.lang.NullPointerException 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at android.app.Activity.startActivityForResult(Activity.java:2528) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at test.phone.PhoneTestService.doIt(PhoneTestService.java:254) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at test.phone.PhoneTestService.onStart(PhoneTestService.java:145) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2429) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at android.app.ActivityThread.access$3100(ActivityThread.java:112) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at android.os.Handler.dispatchMessage(Handler.java:88) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at android.os.Looper.loop(Looper.java:123) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at android.app.ActivityThread.main(ActivityThread.java:3742) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at java.lang.reflect.Method.invokeNative(Native Method) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at java.lang.reflect.Method.invoke(Method.java:515) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:739) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 11-07 13:24:21.632: ERROR/PhoneTestService(1250): at dalvik.system.NativeStart.main(Native Method) Don't know where to go from here... http://schemas.android.com/apk/res/android"; package="test.phone" android:versionCode="1" android:versionName="1.0.0"> Any ideas appreciated. Thanks, Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] problem obtaining android source from windows/cygwin
bash-3.2$ /cygdrive/c/myRepo/repo init -u git://android.git.kernel.org/platform /manifest.git Traceback (most recent call last): File "/cygdrive/c/myRepo/repo", line 587, in main(sys.argv[1:]) File "/cygdrive/c/myRepo/repo", line 554, in main _Init(args) File "/cygdrive/c/myRepo/repo", line 173, in _Init _CheckGitVersion() File "/cygdrive/c/myRepo/repo", line 202, in _CheckGitVersion proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) File "/cygdrive/c/cygwin/lib/python2.5/subprocess.py", line 593, in __init__ errread, errwrite) File "/cygdrive/c/cygwin/lib/python2.5/subprocess.py", line 1079, in _execute_ child raise child_exception OSError: [Errno 2] No such file or directory I wouldn't describe myself as a Python guru. Has anyone been able to overcome and fix this problem? Thanks much. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] problem downloading Android from windows
bash-3.2$ ../myRepo/repo init -u git://android.git.kernel.org/platform/manifest .git Traceback (most recent call last): File "../myRepo/repo", line 587, in main(sys.argv[1:]) File "../myRepo/repo", line 554, in main _Init(args) File "../myRepo/repo", line 173, in _Init _CheckGitVersion() File "../myRepo/repo", line 202, in _CheckGitVersion proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) File "/cygdrive/c/cygwin/lib/python2.5/subprocess.py", line 593, in __init__ errread, errwrite) File "/cygdrive/c/cygwin/lib/python2.5/subprocess.py", line 1079, in _execute_ child raise child_exception OSError: [Errno 2] No such file or directory Has anyone seen this before &&/|| know how to fix it? Thanks much. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: hanging up/terminating a call in an automated fashion
...Interesting Thanks so much for the reply. Perhaps I have misunderstood but I have some questions about this approach. i) A Broadcast receiver is a passive entity. What would be the active entity that will be generating the Intent? Remember, my code is supposed to be the one to initiate end-of-call NOT a human user. Why would there be an event out there at any given moment waiting for my code to capture? Is there some kind of heart-beat message sent out every so often to indicate an active call? ii) Which Intent is the one of interest? I couldn't find anything that matches in the Standard Broadcast Actions of Google's android.content.Intent write-up page. You might be talking about the ACTION_NEW_OUTGOING_CALL broadcast. However, I don't want to prevent an outgoing call, I want to hang up a call that is already connected - whether the call originated from or is answered by the g-phone. Paul On Oct 29, 1:42 am, legerb <[EMAIL PROTECTED]> wrote: > You can use a BroadcastReceiver to catch the Intent, and terminate it > with abortBroadcast(). > > On Oct 27, 8:50 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > > > Hi - > > > I am looking for a way to terminate a call in anautomatedfashion. > > (I realize it can be done manually - the application requires that it > > have control over the call so that it can hang up automatically.) > > > To initiate a call, one starts an Activity with the ACTION_CALL > > Intent. > > > However, there does not appear to be any corresponding way to end it > > with a corresponding Intent, or using the Telephony or > > TelephonyManager interface/package. > > > The only thing I can thing of is calling finish() on the Activity used > > to start the call - but that doesn't seem right at all. > > > Can anyone shed light on this issue? > > > Thanks much. > > > Paul > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: hanging up/terminating a call in an automated fashion
Second question is how to hang up an ~incoming~ call after it has been answered On Oct 27, 11:50 am, dreamerBoy <[EMAIL PROTECTED]> wrote: > Hi - > > I am looking for a way to terminate a call in an automated fashion. > (I realize it can be done manually - the application requires that it > have control over the call so that it can hang up automatically.) > > To initiate a call, one starts an Activity with the ACTION_CALL > Intent. > > However, there does not appear to be any corresponding way to end it > with a corresponding Intent, or using the Telephony or > TelephonyManager interface/package. > > The only thing I can thing of is calling finish() on the Activity used > to start the call - but that doesn't seem right at all. > > Can anyone shed light on this issue? > > Thanks much. > > Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] hanging up/terminating a call in an automated fashion
Hi - I am looking for a way to terminate a call in an automated fashion. (I realize it can be done manually - the application requires that it have control over the call so that it can hang up automatically.) To initiate a call, one starts an Activity with the ACTION_CALL Intent. However, there does not appear to be any corresponding way to end it with a corresponding Intent, or using the Telephony or TelephonyManager interface/package. The only thing I can thing of is calling finish() on the Activity used to start the call - but that doesn't seem right at all. Can anyone shed light on this issue? Thanks much. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: obtaining an IPhone.Stub
Yeah, saw that. If you read it carefully, there's no way to place an outgoing call. The damn API changed... I believe the answer I was looking for was http://code.google.com/android/reference/android/content/Intent.html ACTION_CALL I'm still a bit unclear on the entire picture. I guess the receiver here lives in the background and is launched automagically on startup by Android (sort of like a system daemon on unix)? Upon receiving your intent, it actually triggers the phone to initiate a call? Is there some way to list all of these background services? Can anyone help fill out the picture? Thanks - Paul On Oct 22, 7:20 pm, hackbod <[EMAIL PROTECTED]> wrote: > These are not public APIs. The telephony APIs are here: > > http://code.google.com/android/reference/android/telephony/package-su... > > On Oct 22, 1:38 pm, dreamerBoy <[EMAIL PROTECTED]> wrote: > > > Hi - > > > I need to be able to place outgoing calls and interact with IPhone. > > This apparently, ~was~ the way to get it: > > > private static IPhone getPhoneInterface() throws DeadObjectException { > > IServiceManager sm = ServiceManagerNative.getDefault(); > > IPhone phoneService = > > IPhone.Stub.asInterface(sm.getService("phone")); > > return phoneService; > > > } > > > However, my eclipse project does not accept: > > > import android.os.ServiceManagerNative; > > > and there is no longer a ServiceManagerNative class in the android > > javadoc. > > > The API must have changed. Does anyone know the new way to do this? > > > Much obliged. > > > Paul > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] obtaining an IPhone.Stub
Hi - I need to be able to place outgoing calls and interact with IPhone. This apparently, ~was~ the way to get it: private static IPhone getPhoneInterface() throws DeadObjectException { IServiceManager sm = ServiceManagerNative.getDefault(); IPhone phoneService = IPhone.Stub.asInterface(sm.getService("phone")); return phoneService; } However, my eclipse project does not accept: import android.os.ServiceManagerNative; and there is no longer a ServiceManagerNative class in the android javadoc. The API must have changed. Does anyone know the new way to do this? Much obliged. Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---