[android-developers] Does setting "Automatic date and time" may lead to sometimes missing an alarm?
I guess that the setting "Automatic date and time" within the Settings app may include time jumps at some unknown times. Does anybody know whether a forward jump in time may lead to a missing alarm - because the requested alarm time was never seen by the operating system? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/5aaf8c2b-bbc9-4fdb-8c53-8956bd89079fn%40googlegroups.com.
Re: [android-developers] how to read contact details
Thank you - this link is what I was looking for! -- 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] how to read contact details
I want to get some details from the contacts. This is how I do it, contact selection works fine, but getting the contact details works only for some of the contacts: // select one of the contacts - c = mContentResolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"); while(c.moveToNext()) // show all contacts displayNames.add(c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); int index = ... // select one of the contacts c.moveToPosition(index); String contactId = c.getString(c.getColumnIndex(ContactsContract.Contacts._ID)); // get given name - c = getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME}, ContactsContract.Data.CONTACT_ID + " = " + contactId, null, null); if(c.moveToPosition(1)) String givenName = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME)); // get family name - c = getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME}, ContactsContract.Data.CONTACT_ID + " = " + contactId, null, null); if(c.moveToPosition(1)) String familyName = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME)); // get company name - c = getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.Organization.COMPANY}, ContactsContract.Data.CONTACT_ID + " = " + contactId, null, null); if(c.moveToPosition(2)) String Company = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Organization.COMPANY)); // get mobile phone number -- c = getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER}, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null, null); if(c.moveToPosition(1)) String mobilePhoneNumber = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); // get email address - c = getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[]{ContactsContract.CommonDataKinds.Email.ADDRESS}, ContactsContract.CommonDataKinds.Email.CONTACT_ID +" = "+ contactId, null, null); if(c.moveToPosition(3)) String eMailAddress = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS)); Those "if(c.moveToPosition(...))" are strange, but seem necessary. Any ideas to make this work reliably? -- 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: AlarmManager cancel does not work
This is really strange: When shifting the alarm time for one minute, the old alarm is not cancelled and I get two alarms one minute apart. When shifting the alarm time for one day, the old alarm is cancelled. How can this happen? The cancel command doesn't know the alarm times. I use the intent without any text. Plaese help! -- 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: AlarmManager cancel does not work
I stored the text_of_last_alarm in a file and checked with the debugger that the cancel command really has got the text of the alarm to cancel. I understand that I should not use the intent type to carry arbitrary test. I also tried to transport the text with the intent extras as you suggested, but the OnAlarmReceiver gets an intent with just "android.intent.extra.ALARM_COUNT" as the only extra - the text I gave to the intent is lost. So I was looking for another way to feed some text through the AlarmManager. Most important to me: the cancelling of an alarm still does not work, even when I set neither type nor extras of the intent. Cancelling of the old alarm and setting a new one now looks like this: AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent x = new Intent(context, OnAlarmReceiver.class); PendingIntent pi = PendingIntent.getBroadcast(context, 0, x, 0); am.cancel(pi); if(alarm_needed) am.set(AlarmManager.RTC_WAKEUP, time, pi); These lines are called with every alarm change. -- 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] AlarmManager cancel does not work
I use alarms and I use the type of the intent to carry some text. When the alarm time has changed, I try to cancel the old alarm, but this doesn't work: AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent in = new Intent(context, OnAlarmReceiver.class); in.setType(text_of_last_alarm); PendingIntent pi = PendingIntent.getBroadcast(context, 0, in, 0); am.cancel(pi); This is how I am setting a new or changed alarm - this works: in = new Intent(context, OnAlarmReceiver.class); in.setType(text_of_new_alarm); PendingIntent pi = PendingIntent.getBroadcast(context, 0, in, 0); am.set(AlarmManager.RTC_WAKEUP, time, pi); text_of_last_alarm = text_of_new_alarm; Any Ideas? -- 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
Re: [android-developers] Re: Crash after StartActivity
The LogCat contents after the crash is ERROR/AndroidRuntime(19994): java.lang.RuntimeException: Unable to start receiver irp.plan.OnAlarmReceiver: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? ... ERROR/AndroidRuntime(19994): Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? So I guess I have to add the FLAG_ACTIVITY_NEW_TASK flag to the intent to start the activity, because the startActivity() is called from inside the message receiver OnAlarmReceiver. Am 29.01.2012 16:09, schrieb Kostya Vasilyev: Press F8 (Resume) in Eclipse a few times until you get the crash dialog on the device. Then check the logcat. Look for the part after "Caused by:" -- Kostya 29.01.2012 15:21, Rudolf Polzer пишет: The manifest file contains within the tag. The stack is ActivityThread.handleReceiver(ActivityThread$ReceiverData) line: 2639 ActivityThread.access$3100(ActivityThread, ActivityThread $ReceiverData) line: 119 ActivityThread$H.handleMessage(Message) line: 1913 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 -- 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: Crash after StartActivity
The manifest file contains within the tag. The stack is ActivityThread.handleReceiver(ActivityThread$ReceiverData) line: 2639 ActivityThread.access$3100(ActivityThread, ActivityThread $ReceiverData) line: 119 ActivityThread$H.handleMessage(Message) line: 1913 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 On 28 Jan., 13:25, YuviDroid wrote: > Can you post the entire stack trace? > > First thing that pops to my mind is: have you declared your WakeActivity in > the android manifest? > > On Sat, Jan 28, 2012 at 11:48 AM, Rudolf Polzer wrote: > > > > > > > > > > > I am working on an app for andoid 2.1-update 1 (API Level 7). > > After calling > > context.startActivity(new Intent(context, WakeActivity.class)); > > the app crashes. The stack is then > > ActivityThread.handleReceiver(ActivityThread$ReceiverData) line: > > 2639 > > This may be "unable to start receiver", but why? > > > -- > > 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 > > -- > YuviDroid > Check out Launch-X <http://android.yuvalsharon.net/launchx.php> (a widget > to quickly access your favorite apps and > contacts!)http://android.yuvalsharon.net -- 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] Crash after StartActivity
I am working on an app for andoid 2.1-update 1 (API Level 7). After calling context.startActivity(new Intent(context, WakeActivity.class)); the app crashes. The stack is then ActivityThread.handleReceiver(ActivityThread$ReceiverData) line: 2639 This may be "unable to start receiver", but why? -- 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: AlarmManager does not fire?
I removed the inner classes: I put the classes WakefulIntentService, OnAlarmReceiver and AppService into separate files and now the alarm manager is working. 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: AlarmManager does not fire?
This is the stack when the receiver crashes: ActivityThread.handleReceiver(ActivityThread$ReceiverData) line: 2616 ActivityThread.access$3100(ActivityThread, ActivityThread $ReceiverData) line: 119 ActivityThread$H.handleMessage(Message) line: 1913 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 -- 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: AlarmManager does not fire?
Yes, the receiver is an inner class of the activity. I changed the receiver line in the manifest file to Then the alarm fires, but with an exception the debugger can't display. LogCat says: newInstance failed: no () -- 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: AlarmManager does not fire?
"adb shell dumpsys alarm" tells the following about my alarm: irp.plan 17ms running, 1 wakeups 1 alarms: flg=0x4 cmp=irp.plan/.PlanActivity$OnAlarmReceiver which is not present after a call of am.cancel(pi); So I guess that the setting of the alarm works, but the broadcast message does not arrive. The missing intent-filter is the same as in the example software cw-advandroid / SystemServices / Alarm / AndroidManifest.xml -- 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: AlarmManager does not fire?
I have replaced every c by this.getApplicationContext(). The setting of the alarm is executed, I checked this with the debugger. LogCat says nothing about alarms or broadcast messages during the time of interest and LogCat also displays no warnings. So what is wrong? -- 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] AlarmManager does not fire?
Please give me a hint why the AlarmManager does not fire. In my app, the AlarmManager is set after a user action: Context c = this.getApplicationContext(); AlarmManager am = (AlarmManager)c.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(c, OnAlarmReceiver.class); PendingIntent pi = PendingIntent.getBroadcast(c, 0, i, 0); am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 1, pi); The "+ 1" is for testing - this numer will be replaced by a bigger one. The manifest file contains And the alarm receiver code is never executed: public class OnAlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // ...code here is never executed } } -- 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