[android-developers] Loading contact photos in Android 2.0

2009-11-10 Thread Adam K
Hi all,

I'm using ContactsContract.Contacts.openContactPhotoInputStream() to
load contact photos in Android 2.0 and users are reporting that some
contact photos are not showing correctly.  Does anyone know if this
method will query all available photos for a particular aggregate
contact?

Thanks,

Adam

-- 
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: How Delete SMS from inbox programmatically OR discard it before received in inbox

2009-04-26 Thread Adam K

Scroll down a bit on the page I sent for an example of how to retrieve
a message from the system content provider:
http://code.google.com/p/android-smspopup/source/browse/tags/SMSPopup%20v0.9.93/src/net/everythingandroid/smspopup/SMSPopupUtils.java#553

Cheers,

Adam K
www.everythingandroid.net

On Apr 21, 4:16 am, Gulfam gulfa...@gmail.com wrote:
 Hi all,

 Thanks for response. How i can get thread_id or message id ?

 Regards,
 Gulfam

 On Apr 21, 9:14 am, Adam K a...@everythingandroid.net wrote:



  You candeleteby message id, see 
  here:http://code.google.com/p/android-smspopup/source/browse/tags/SMSPopup...

  Cheers,

  Adam Kwww.everythingandroid.net

  On Mon, Apr 20, 2009 at 11:38 AM, avrono avr...@mail.com wrote:

   Gulfram,

   As far as I can see you can onlydeleteandsmsby thread_id using the
   content content://sms/conversations/

   Regards
   Avron

   On Feb 20, 9:45 am, Gulfam Hassan gulfa...@gmail.com wrote:
Hi,

I want toDeleteSMShow i candeleteit programmatically?
I am receivingsmsin my application in this format string. 12345
username password
**
i have post this thread on so many groups and forums but i dont receive
   any
reply from last one week.
its very urgent for our product. so i am sending this mail  to all of
   you.
***
public void onReceive(Context context, Intent intent) {

               if(!intent.getAction().equals
(android.provider.Telephony.SMS_RECEIVED))
                       {
                               return;
                       }
                       SmsMessage smsMsg[] =
getMessagesFromIntent(intent);// here gettingsmssuccessfully

                       for(int i=0; i  smsMsg.length; i++)
                       {
                               receivedSMS =
smsMsg[i].getDisplayMessageBody();
                               if(receivedSMS.startsWith(12345))
                                 {
                                         String[] dataArray =
MyUtility.breakIntoLines(receivedSMS, '
');
                                         String userName = dataArray[1];
                                         String userPassword =
   dataArray[2];

 this.updateUsernamePassword(context, userName, userPassword );//here
   saving
data successfully
                                         
Toast.makeText(context,Settings
saved, Toast.LENGTH_LONG).show
();

                                     try{

    ***here
i want todeletethat perticullarsms***
                                                 Uri uriSms =
Uri.parse(content://sms/inbox);
                                                  Cursor c =
context.getContentResolver().query(uriSms, null,null,null,null);
                                                int thread_id
   =c.getCount();
//get the thread_id

   context.getContentResolver().delete(Uri.parse(content://sms/conversations/
­+thread_id
),null,null);

                      }catch(Exception e)
                        {
                            Log.i(exception ,e.getMessage());
                        }

                                           }
                                 }

                   }

          }

after getting my required
data i want todeletethis currently receivedsmsprogrammatically.
data is very confidential in thissmsand i want todeleteit here
after getting data and also clear it from notification bar.or i want to
discard it because i dont want to show it in inbox
any one can help me regarding this.can any one give me code snippet
which was working perfectly for deletingsmsor discarding it.

Thanks  Regards,
Gulfam
--~--~-~--~~~---~--~~
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: How Delete SMS from inbox programmatically OR discard it before received in inbox

2009-04-20 Thread Adam K
You can delete by message id, see here:
http://code.google.com/p/android-smspopup/source/browse/tags/SMSPopup%20v0.9.93/src/net/everythingandroid/smspopup/SMSPopupUtils.java#290

Cheers,

Adam K
www.everythingandroid.net

On Mon, Apr 20, 2009 at 11:38 AM, avrono avr...@mail.com wrote:


 Gulfram,

 As far as I can see you can only delete and sms by thread_id using the
 content content://sms/conversations/

 Regards
 Avron

 On Feb 20, 9:45 am, Gulfam Hassan gulfa...@gmail.com wrote:
  Hi,
 
  I want to Delete SMS how i can delete it programmatically?
  I am receiving sms in my application in this format string. 12345
  username password
  **
  i have post this thread on so many groups and forums but i dont receive
 any
  reply from last one week.
  its very urgent for our product. so i am sending this mail  to all of
 you.
  ***
  public void onReceive(Context context, Intent intent) {
 
 if(!intent.getAction().equals
  (android.provider.Telephony.SMS_RECEIVED))
 {
 return;
 }
 SmsMessage smsMsg[] =
  getMessagesFromIntent(intent);// here getting sms successfully
 
 for(int i=0; i  smsMsg.length; i++)
 {
 receivedSMS =
  smsMsg[i].getDisplayMessageBody();
 if(receivedSMS.startsWith(12345))
   {
   String[] dataArray =
  MyUtility.breakIntoLines(receivedSMS, '
  ');
   String userName = dataArray[1];
   String userPassword =
 dataArray[2];
 
   this.updateUsernamePassword(context, userName, userPassword );//here
 saving
  data successfully
   Toast.makeText(context,Settings
  saved, Toast.LENGTH_LONG).show
  ();
 
   try{
 
  ***here
  i want to delete that perticullar sms ***
   Uri uriSms =
  Uri.parse(content://sms/inbox);
Cursor c =
  context.getContentResolver().query(uriSms, null,null,null,null);
  int thread_id
 =c.getCount();
  //get the thread_id
 
 
 context.getContentResolver().delete(Uri.parse(content://sms/conversations/­+thread_id
  ),null,null);
 
}catch(Exception e)
  {
  Log.i(exception ,e.getMessage());
  }
 
 }
   }
 
 }
 
}
 
  after getting my required
  data i want to delete this currently received sms programmatically.
  data is very confidential in this sms and i want to delete it here
  after getting data and also clear it from notification bar.or i want to
  discard it because i dont want to show it in inbox
  any one can help me regarding this.can any one give me code snippet
  which was working perfectly for deleting sms or discarding it.
 
  Thanks  Regards,
  Gulfam

 


--~--~-~--~~~---~--~~
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] Exception: WakeLock finalized while still held

2009-01-21 Thread Adam K

Hi all,

I'm seeing the following error intermittently when testing my app:
01-20 23:56:52.794: DEBUG/dalvikvm(25525): GC freed 1616 objects /
94232 bytes in 87ms
01-20 23:56:52.874: ERROR/AndroidRuntime(25525): java.lang.Exception:
WakeLock finalized while still held: App Name
01-20 23:56:52.874: ERROR/AndroidRuntime(25525): at
android.os.PowerManager$WakeLock.finalize(PowerManager.java:295)
01-20 23:56:52.874: ERROR/AndroidRuntime(25525): at
dalvik.system.NativeStart.run(Native Method)

It looks like GC is cleaning my context while it is holding the
WakeLock, I'm using a static class to manage the wakelocks, how can I
ensure the context that holds the wakelock does not get GC'd?

Adam

--~--~-~--~~~---~--~~
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] Work out which activity is on top

2008-12-23 Thread Adam K

Hi all,

Is there a way for a receiver or service to know which activity is
currently visible to the user so that you can change behavior?
Similarly, is there a way to know if the screen is off (perhaps this
should be a function of the wakelock service)?

Thanks,

Adam
--~--~-~--~~~---~--~~
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: Activity finishOnBackground attribute

2008-12-11 Thread Adam K
ping!  is the documentation out of date?  or am i not understanding how to
use finishOnBackground?

On Mon, Dec 8, 2008 at 2:48 PM, Adam K [EMAIL PROTECTED] wrote:


 Hi all,

 I want to do the following for a notification type activity that
 should be removed/closed from the system either via a button in the
 activity, or the user leaving with back or home:

 from - http://code.google.com/android/intro/appmodel.html
 Another approach you can take is to set the notification activity's
 task affinity to the empty string  (indicating no affinity) and
 setting the finishOnBackground attribute. ... By specifying this
 attribute, the activity will be finished whether the user leaves it
 with BACK or HOME; if the attribute isn't specified, pressing HOME
 will result in the activity and its task remaining in the system,
 possibly with no way to return to it.

 However, I don't see any other references in the docs to
 finishOnBackground - the link on that page takes me to
 finishOnTaskLaunch instead.  Any ideas?

 Thanks,

 Adam

 


--~--~-~--~~~---~--~~
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: Activity finishOnBackground attribute

2008-12-11 Thread Adam K
Does it do exactly the same thing?  It sounds to me like finishOnTaskLaunch
finishes an activity when it is relaunched from the homescreen - what I
wanted to do is have an activity finish when it goes to the background.  Or
would this be identical as calling finish() in the onPause() method?

On Thu, Dec 11, 2008 at 5:16 PM, Dianne Hackborn hack...@android.comwrote:

 Yes the documentation is out of date, it got renamed to finishOnTaskLaunch.

 On Thu, Dec 11, 2008 at 7:57 AM, Adam K a...@everythingandroid.netwrote:

 ping!  is the documentation out of date?  or am i not understanding how to
 use finishOnBackground?


 On Mon, Dec 8, 2008 at 2:48 PM, Adam K a...@everythingandroid.netwrote:


 Hi all,

 I want to do the following for a notification type activity that
 should be removed/closed from the system either via a button in the
 activity, or the user leaving with back or home:

 from - http://code.google.com/android/intro/appmodel.html
 Another approach you can take is to set the notification activity's
 task affinity to the empty string  (indicating no affinity) and
 setting the finishOnBackground attribute. ... By specifying this
 attribute, the activity will be finished whether the user leaves it
 with BACK or HOME; if the attribute isn't specified, pressing HOME
 will result in the activity and its task remaining in the system,
 possibly with no way to return to it.

 However, I don't see any other references in the docs to
 finishOnBackground - the link on that page takes me to
 finishOnTaskLaunch instead.  Any ideas?

 Thanks,

 Adam








 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them.



 


--~--~-~--~~~---~--~~
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: Detecting if screen is off

2008-11-24 Thread Adam K
Yes I realize this, which is why I have a 5 minute timeout on the wakelock
(and on the notification).  I also have this as a preference for my app so
you can turn it on or off as suits you (some users specifically requested
this feaure).

IMO, turning on the screen for a short period of time and optionally
displaying a message (on top of the keyguard) should be a part of a
Notification object.  The built-in alarm does exactly this (which is
basically what I want to do - except if the user is playing a game or doing
something when my alarm goes I want to use the regular Notification manager
so as not to disrupt the user - something the built-in Alarm should probably
do ...)

So back to my original question - is there a way to detect if the screen is
off?

Adam

On Mon, Nov 24, 2008 at 9:28 AM, Jean-Baptiste Queru [EMAIL PROTECTED] wrote:


 Forcibly turning the screen on when you're not sure that the user is
 looking is a sure way to drain the battery in a few hours. You should
 probably avoid that.

 JBQ

 On Sun, Nov 23, 2008 at 8:52 AM, Adam K [EMAIL PROTECTED]
 wrote:
 
  Hi all,
 
  Is there a way to detect if the screen is off?  I want to be able to
  show a dialog if the screen is off (using a wakelock) but if the
  screen is on I want to show a notification (so as not to interfere
  with what the user is doing).
 
  Thanks,
 
  Adam
  
 

 


--~--~-~--~~~---~--~~
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: Detecting if screen is off

2008-11-24 Thread Adam K
Right - but I only want to display a dialog activity when the screen is off
- if the screen is on (ie. user is doing something) then I want to just use
a Notification so as not to interrupt the user experience (as recommended in
the docs).

So alternatively - is there a way to detect if the screen is on? :)

Adam

On Mon, Nov 24, 2008 at 2:31 PM, Dianne Hackborn [EMAIL PROTECTED]wrote:

 There is no need to find out whether the screen is off for this, just
 acquire a wake lock that turns the screen on (if it isn't already) like the
 alarm app does.

 On Mon, Nov 24, 2008 at 11:00 AM, Adam K [EMAIL PROTECTED]wrote:

 Yes I realize this, which is why I have a 5 minute timeout on the wakelock
 (and on the notification).  I also have this as a preference for my app so
 you can turn it on or off as suits you (some users specifically requested
 this feaure).

 IMO, turning on the screen for a short period of time and optionally
 displaying a message (on top of the keyguard) should be a part of a
 Notification object.  The built-in alarm does exactly this (which is
 basically what I want to do - except if the user is playing a game or doing
 something when my alarm goes I want to use the regular Notification manager
 so as not to disrupt the user - something the built-in Alarm should probably
 do ...)

 So back to my original question - is there a way to detect if the screen
 is off?

 Adam


 On Mon, Nov 24, 2008 at 9:28 AM, Jean-Baptiste Queru [EMAIL 
 PROTECTED]wrote:


 Forcibly turning the screen on when you're not sure that the user is
 looking is a sure way to drain the battery in a few hours. You should
 probably avoid that.

 JBQ

 On Sun, Nov 23, 2008 at 8:52 AM, Adam K [EMAIL PROTECTED]
 wrote:
 
  Hi all,
 
  Is there a way to detect if the screen is off?  I want to be able to
  show a dialog if the screen is off (using a wakelock) but if the
  screen is on I want to show a notification (so as not to interfere
  with what the user is doing).
 
  Thanks,
 
  Adam
  
 








 --
 Dianne Hackborn
 Android framework engineer
 [EMAIL PROTECTED]

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them.



 


--~--~-~--~~~---~--~~
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] Detecting if screen is off

2008-11-23 Thread Adam K

Hi all,

Is there a way to detect if the screen is off?  I want to be able to
show a dialog if the screen is off (using a wakelock) but if the
screen is on I want to show a notification (so as not to interfere
with what the user is doing).

Thanks,

Adam
--~--~-~--~~~---~--~~
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: AlarmManager not always waking device (using RTC_WAKEUP)

2008-11-18 Thread Adam K
Thanks Dianne.

Should I be holding a wakelock in the pendingintent receiver of the
alarm (basically acquiring at the start of the onReceive() and
releasing at the end)?  All I am doing in the receiver is setting off
a notification - I am not creating any other intents or accessing any
other threads or services.

Cheers,

Adam

On Tue, Nov 18, 2008 at 9:22 PM, Dianne Hackbod [EMAIL PROTECTED] wrote:

 Fwiw, I am not aware of any issues with the alarm itself not waking up the
 phone.  Typically bugs in this area are a result of applications not holding
 wake locks the entire time needed.

 Note that the behavior when not holding a wake lock can change
 significantly between devices, depending on things like how often sync is
 running.


 On Tue, Nov 18, 2008 at 6:15 PM, Adam K [EMAIL PROTECTED]wrote:


 Ping.  Anyone?  It seems for certain people the alarm can never wake
 up the phone.  For others (like myself) it pretty much always wakes up
 the phone.

 Thanks,

 Adam

 On Nov 16, 8:15 pm, Adam K [EMAIL PROTECTED] wrote:
  Hi all,
 
  I noticed that AlarmManager does not always seem to wake the device
  correctly when using types RTC_WAKEUP or ELAPSED_REALTIME_WAKEUP.  It
  seems like whatever intent was pending is triggered later after the
  Menu key is hit.
 
  I realize you need to hold a wakelock for any activity fired after the
  initial pending intent event - but I thought at least the pending
  intent should execute without a wakelock being required?  All I want
  to do is set off a Notification when the alarm is complete - nothing
  else.
 
  It does seem to work 90% of the time without an issue, just not 100%
  of the time.  Has anyone else noticed this?
 
  Here is a summarized version of what I'm doing:
 
  //in main activity, set alarm for some time in future
  myPendingIntent = PendingIntent.getBroadcast(myContext, 0, new
  Intent(myContext, MyReceiver.class), 0);
  myAM = (AlarmManager) getSystemService(ALARM_SERVICE);
  myAM.set(AlarmManager.RTC_WAKEUP, getTriggerTime(), myPendingIntent);
 
  //in MyReceiver.class, onReceiver(), trigger notification
  NotificationManager myNM = (NotificationManager)
  context.getSystemService(Context.NOTIFICATION_SERVICE);
  Notification notif = new Notification();
  ..setup notification to play alarm, vibrate etc.
  myNM.notify(MYNOTIFICATION_ID, notif);
 
  Thanks,
 
  Adam




 --
 Dianne Hackborn
 [EMAIL PROTECTED]



 


--~--~-~--~~~---~--~~
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] AlarmManager not always waking device (using RTC_WAKEUP)

2008-11-16 Thread Adam K

Hi all,

I noticed that AlarmManager does not always seem to wake the device
correctly when using types RTC_WAKEUP or ELAPSED_REALTIME_WAKEUP.  It
seems like whatever intent was pending is triggered later after the
Menu key is hit.

I realize you need to hold a wakelock for any activity fired after the
initial pending intent event - but I thought at least the pending
intent should execute without a wakelock being required?  All I want
to do is set off a Notification when the alarm is complete - nothing
else.

It does seem to work 90% of the time without an issue, just not 100%
of the time.  Has anyone else noticed this?

Here is a summarized version of what I'm doing:

//in main activity, set alarm for some time in future
myPendingIntent = PendingIntent.getBroadcast(myContext, 0, new
Intent(myContext, MyReceiver.class), 0);
myAM = (AlarmManager) getSystemService(ALARM_SERVICE);
myAM.set(AlarmManager.RTC_WAKEUP, getTriggerTime(), myPendingIntent);

//in MyReceiver.class, onReceiver(), trigger notification
NotificationManager myNM = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notif = new Notification();
..setup notification to play alarm, vibrate etc.
myNM.notify(MYNOTIFICATION_ID, notif);

Thanks,

Adam

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---