[android-developers] Re: intent-filter for addContact and editContact ?

2008-12-09 Thread jaspher

hello everyboday

thank you for your support and sorry for my slowly answer...
it works with a contentResolver and a ContentObserver (code).
do you mean that it isn't for the performance of the device not a good
idea to work with something like that?
thanks in advance



public class BackgroundService extends Service {

private Handler handler = new Handler();

@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}

public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);

System.out.println(BACKGROUND SERVICE IS RUNNING);
ContactsContentObserver cco = new 
ContactsContentObserver(handler);

ContentResolver contentResolver = getContentResolver();

contentResolver.registerContentObserver(Contacts.People.CONTENT_URI,
true, cco);

}

private class ContactsContentObserver extends ContentObserver {

public ContactsContentObserver(Handler h) {
super(h);
}

public void onChange(boolean selfChange) {
System.out.println(SOMEBODAY CHANGED ANYTHING AT THE 
CONTACTS);
}
}

}




On 5 Dez., 00:24, Dianne Hackborn [EMAIL PROTECTED] wrote:
 Yes, this is the way to monitor for content provider changes.  Note that
 this is deliberately not done as a broadcast, you can only receive these
 while you are running by explicitly registering for them, because we didn't
 want to get in the situation of launching 1 or more apps every time some
 piece of data in a content provider changes.

 On Thu, Dec 4, 2008 at 3:08 PM, Bill Napier [EMAIL PROTECTED] wrote:

  I would start looking here:

 http://code.google.com/android/reference/android/content/ContentResol...http://code.google.com/android/reference/android/content/ContentResol...
  ,
  boolean, android.database.ContentObserver)

  with ContentObserver.registerContentObserver which sounds like it
  should do what you want.  I haven't used the function yet, so you may
  have to mess with it.  Please report back you results so others can
  know the answer too.  Thanks!

  Bill

  On Thu, Dec 4, 2008 at 6:11 AM, jaspher [EMAIL PROTECTED] wrote:

   hello

   I'm looking for a intent-filter which can start my BroadcastReciver
   when somebody adds a new contact or edit a contact. Unfortunately I
   couldn't finde something like that. Does it exist?
   If not how can I get a Notification when somebody added a new contact
   or something like that?
   thanks in advance

   jaspher

 --
 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] Re: intent-filter for addContact and editContact ?

2008-12-09 Thread Dianne Hackborn
I was just explaining why we designed things the way we did.

On Tue, Dec 9, 2008 at 8:25 AM, jaspher [EMAIL PROTECTED] wrote:


 hello everyboday

 thank you for your support and sorry for my slowly answer...
 it works with a contentResolver and a ContentObserver (code).
 do you mean that it isn't for the performance of the device not a good
 idea to work with something like that?
 thanks in advance



 public class BackgroundService extends Service {

private Handler handler = new Handler();

@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}

public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);

System.out.println(BACKGROUND SERVICE IS RUNNING);
ContactsContentObserver cco = new
 ContactsContentObserver(handler);

ContentResolver contentResolver = getContentResolver();

  contentResolver.registerContentObserver(Contacts.People.CONTENT_URI,
 true, cco);

}

private class ContactsContentObserver extends ContentObserver {

public ContactsContentObserver(Handler h) {
super(h);
}

public void onChange(boolean selfChange) {
System.out.println(SOMEBODAY CHANGED ANYTHING AT
 THE CONTACTS);
 }
}

 }




 On 5 Dez., 00:24, Dianne Hackborn [EMAIL PROTECTED] wrote:
  Yes, this is the way to monitor for content provider changes.  Note that
  this is deliberately not done as a broadcast, you can only receive these
  while you are running by explicitly registering for them, because we
 didn't
  want to get in the situation of launching 1 or more apps every time some
  piece of data in a content provider changes.
 
  On Thu, Dec 4, 2008 at 3:08 PM, Bill Napier [EMAIL PROTECTED] wrote:
 
   I would start looking here:
 
  http://code.google.com/android/reference/android/content/ContentResol..
 .http://code.google.com/android/reference/android/content/ContentResol..
 .
   ,
   boolean, android.database.ContentObserver)
 
   with ContentObserver.registerContentObserver which sounds like it
   should do what you want.  I haven't used the function yet, so you may
   have to mess with it.  Please report back you results so others can
   know the answer too.  Thanks!
 
   Bill
 
   On Thu, Dec 4, 2008 at 6:11 AM, jaspher [EMAIL PROTECTED] wrote:
 
hello
 
I'm looking for a intent-filter which can start my BroadcastReciver
when somebody adds a new contact or edit a contact. Unfortunately I
couldn't finde something like that. Does it exist?
If not how can I get a Notification when somebody added a new contact
or something like that?
thanks in advance
 
jaspher
 
  --
  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.
 



-- 
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] Re: intent-filter for addContact and editContact ?

2008-12-04 Thread Bill Napier

I would start looking here:

http://code.google.com/android/reference/android/content/ContentResolver.html#registerContentObserver(android.net.Uri,
boolean, android.database.ContentObserver)

with ContentObserver.registerContentObserver which sounds like it
should do what you want.  I haven't used the function yet, so you may
have to mess with it.  Please report back you results so others can
know the answer too.  Thanks!

Bill

On Thu, Dec 4, 2008 at 6:11 AM, jaspher [EMAIL PROTECTED] wrote:

 hello

 I'm looking for a intent-filter which can start my BroadcastReciver
 when somebody adds a new contact or edit a contact. Unfortunately I
 couldn't finde something like that. Does it exist?
 If not how can I get a Notification when somebody added a new contact
 or something like that?
 thanks in advance

 jaspher

 


--~--~-~--~~~---~--~~
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: intent-filter for addContact and editContact ?

2008-12-04 Thread Bill Napier

I would start looking here:

http://code.google.com/android/reference/android/content/ContentResolver.html#registerContentObserver(android.net.Uri,
boolean, android.database.ContentObserver)

with ContentObserver.registerContentObserver which sounds like it
should do what you want.  I haven't used the function yet, so you may
have to mess with it.  Please report back you results so others can
know the answer too.  Thanks!

Bill

On Thu, Dec 4, 2008 at 6:11 AM, jaspher [EMAIL PROTECTED] wrote:

 hello

 I'm looking for a intent-filter which can start my BroadcastReciver
 when somebody adds a new contact or edit a contact. Unfortunately I
 couldn't finde something like that. Does it exist?
 If not how can I get a Notification when somebody added a new contact
 or something like that?
 thanks in advance

 jaspher

 


--~--~-~--~~~---~--~~
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: intent-filter for addContact and editContact ?

2008-12-04 Thread Dianne Hackborn
Yes, this is the way to monitor for content provider changes.  Note that
this is deliberately not done as a broadcast, you can only receive these
while you are running by explicitly registering for them, because we didn't
want to get in the situation of launching 1 or more apps every time some
piece of data in a content provider changes.

On Thu, Dec 4, 2008 at 3:08 PM, Bill Napier [EMAIL PROTECTED] wrote:


 I would start looking here:


 http://code.google.com/android/reference/android/content/ContentResolver.html#registerContentObserver(android.net.Urihttp://code.google.com/android/reference/android/content/ContentResolver.html#registerContentObserver%28android.net.Uri
 ,
 boolean, android.database.ContentObserver)

 with ContentObserver.registerContentObserver which sounds like it
 should do what you want.  I haven't used the function yet, so you may
 have to mess with it.  Please report back you results so others can
 know the answer too.  Thanks!

 Bill

 On Thu, Dec 4, 2008 at 6:11 AM, jaspher [EMAIL PROTECTED] wrote:
 
  hello
 
  I'm looking for a intent-filter which can start my BroadcastReciver
  when somebody adds a new contact or edit a contact. Unfortunately I
  couldn't finde something like that. Does it exist?
  If not how can I get a Notification when somebody added a new contact
  or something like that?
  thanks in advance
 
  jaspher
 
  
 

 



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