[android-developers] Get true timestamps of motion sensors on Android

2017-09-20 Thread Yao Chen
It is known that readings of motion sensors are cached on queues, so there 
might be elapsed time between when the data are actually sampled and when 
they are popped from the queue. Is the timestamp member in SensorEvent the 
time when the data are sampled? According to the documentation in 
SensorEvent 
, 
it is probably not. Is there a way to measure the "true" timestamp at which 
the data are sampled? Thank you.

-- 
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 post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/4fc37681-38ec-4e13-8418-2f9e7db26d30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] My first app was suspended by Google. Need to get it back!

2016-10-25 Thread Yao Hong Kok
Hi guys,

My app was suspended by some STUPID MORONS from Google due METADATA Policy 
violation.

Has anyone encounter this before? What is the best way to get my app 
unsuspended? Their email didn't say specifically why they chose to ban my 
app. I have user who love my app and my userbase is growing steadily.

I have spent so much time and effort into this app. Although it doesn't 
make me much money, I take pride in my work. I really want this app to be 
unsuspended because I want to continue deliver value to my users who have 
installed the app.

I am so disappointed with Google. This experience plus my interviewing 
experience pretty much points out that Google is becoming more of a 
douchebag than anything else.

A word of advice to Google's developers - Treat other developers with 
respect. Don't unsuspend app before you even read some feedback from users. 
I have tons of strong, positive beta feedback. For the negative feedback, I 
always reach out to my users so that I can fix it.

Thanks,
Yao

-- 
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 post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/60e8acc4-0c51-41bb-919e-57fedb65a36c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] NFC PBtF function can't work on Android 4.0.4

2012-09-29 Thread Yao-Tsu Lin
Hi, I developing NFC function now, I discover the NFC jni source code 
different from Android 2.3.7 to Android 4.0.4.
Those different caused NFC function PBtF(Power By the Field) can not work.
Would you please help to answer that modify for what purpose?
And how to turn on the NFC PBtf function in Android 4.0.4?

YaoTsu LIn

The source code show on following.
/packages/apps/Nfc/jni/com_android_nfc_NativeNfcManager.cpp 

*In function com_android_nfc_NfcManager_doSelectSecureElement*
/*Android 2.3.7 code base*/
ret = phLibNfc_SE_SetMode(seID, phLibNfc_SE_ActModeVirtual, 
nfc_jni_se_set_mode_callback,
(void *)cb_data);

/* Android 4.0.4 code base*/
if(seID == 0xABCDF0)
{
TRACE(Select UICC);
ret = phLibNfc_SE_SetMode(seID, phLibNfc_SE_ActModeVirtual, 
nfc_jni_se_set_mode_callback,
(void *)cb_data);
}
else
{
TRACE(Select SMX);
ret = phLibNfc_SE_SetMode(seID, phLibNfc_SE_ActModeVirtualVolatile, 
nfc_jni_se_set_mode_callback,
(void *)cb_data);
}

*In function com_android_nfc_NfcManager_doDeselectSecureElement*
/*Android 2.3.7 code base*/
ret = phLibNfc_SE_SetMode(seID, phLibNfc_SE_ActModeOff,
nfc_jni_se_set_mode_callback, (void *)cb_data);

/* Android 4.0.4 code base*/
if(seID == 0xABCDF0)
{
TRACE(Deselect UICC);
ret = phLibNfc_SE_SetMode(seID, phLibNfc_SE_ActModeOff,
nfc_jni_se_set_mode_callback, (void *)cb_data);
}
else
{
TRACE(Deselect SMX);
ret = phLibNfc_SE_SetMode(seID, phLibNfc_SE_ActModeDefault,
nfc_jni_se_set_mode_callback, (void *)cb_data);
}

-- 
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 about recent task list

2011-08-04 Thread Yao Alex
Hi all,

I am having a problem about recent task list on 2.3.3. My app has two
MAIN entrance, they are A and B, entrance A is able to start another
activity, that can be marked as activity C. At the very beginning, the
problem is that entrance A cannot be listed in the recent task list
which can be displayed by long pressing home key, but one of entrance
B or activity C will be listed there if I start C through A. One of
the two activities (yes, B is actually an activity as well) will
replace each other when goes into the list. I solved part of this
problem by adding FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS flag in the
intent when C is being started, and setting the
android:excludeFromRecents property to false for entrance A in
AndroidManifest.xml. Now both A and B can be listed in the recent task
list normally. The problem I am still facing is that when I start C
though A, the entrance B will be removed from the recent task list.
Does any of you knows how can this happen? How can an activity
manage the recent task to remove another task? I think that should
not happen, but unfortunately it is happening so I am begging your
help here. Any one who can support me or tried to help me will have my
appreciate.

-- 
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 detect FPS (frame per second) in video ?

2010-12-01 Thread Paddy Yao
I use VideoView to play video .
I can use getCurrentPosition() to get current run time .
But I don`t know how to detect how many frames has play.

Or I should use the other class but not VideoView ?

Does anyone know this issue?

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: How to bring stop activity to foreground (restart) by itself ??

2010-09-27 Thread Paddy Yao
To ALL:

I want to write a home button function test application .
When activity restart again , I can know button function is work
correctly .
it`s OK now,follow is my code:

Intent i = new Intent(context, Main.class);
i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);

Thanks all.

On 9月23日, 下午10時45分, Bret Foreman bret.fore...@gmail.com wrote:
 Why not just pop up some toast? That's what it's 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 bring stop activity to foreground (restart) by itself ??

2010-09-22 Thread Paddy Yao
Hi~

How to bring stop activity to foreground (restart) by itself ??

i use Broadreceiver and intent to restart my activity:

Intent restartIntent = new Intent();
restartIntent.setClass(context,Main.class );
restartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(restartIntent);

but always start two activity (include original activity)

how to restart my original activity??

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] how to start a stop activity

2010-09-21 Thread Paddy Yao
Hi~

as title , follow is the detail of my problem :

1. press home key to stop my AP (activity change to stop , not
destroy )

2. use CountDownTimer  for  sleep 3  secs , when timer finish  use
sendBroadcast() to call my BroadcastReceiver

3. finally , BroadcastReceiver  use intent to start my AP (activity
change to start)

follow is my code , it does not works correctly .

Thanks

code:

[Main Activity]

public class Main extends Activity {
protected void onStop(){
super.onStop();
RestartCount counter = new RestartCount(5000,1000 );
counter.start();

}
}


public class RestartCount extends CountDownTimer {
public RestartCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}

@Override
public void onFinish() {
Intent it = new Intent(com.demo.TEST_COMPLETED);
sendBroadcast(it);
}
@Override
public void onTick(long millisUntilFinished) {
}
}


[BroadcastReceiver]

public class CompleteReceiver extends BroadcastReceiver {

public CompleteReceiver () {
}
@Override
public void onReceive(Context context, Intent intent) {
Intent restartIntent = new Intent();
restartIntent.setClass(context,Main.class );
restartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(restartIntent);
   }
}

[register BroadcastReceiver in AndroidManifast.xml]

receiver android:name=.CompleteReceiver
intent-filter
action android:name=com.demo.TEST_COMPLETED /
/intent-filter
/receiver

-- 
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: Strange behavior when launching app from Market

2010-05-28 Thread Rico Yao
Thanks for the suggestions.  Unfortunately FLAG_ACTIVITY_CLEAR_TOP doesn't
really work for my app because I need multiple instances of the same
activities.  I guess I'll just ask my users to live with this for now.

Again, thanks.



On Fri, May 28, 2010 at 8:06 AM, TreKing treking...@gmail.com wrote:

 On Thu, May 27, 2010 at 6:07 PM, Rico Yao rico@gmail.com wrote:

 What I'm saying is that when you launch apps through Launchalot, it
 doesn't create multiple instances of the apps it's launching.


 Ah, gotcha - I didn't look deep enough to see the point of Launchalot.


 I was just trying to point out that it should be possible for the Market
 to launch apps in the same way as Launchalot same way and avoid this issue.


 It SHOULD - but then again there are a LOT of things the Market app SHOULD
 do and fails miserably at. Add this to the list. Maybe if someone files a
 bug and hopefully it'll get taken care of ... in like 2 - 3 years =P

 I guess try Max's workaround in the time being?


 -
 TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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: Strange behavior when launching app from Market

2010-05-27 Thread Rico Yao
On Thu, May 27, 2010 at 2:43 PM, TreKing treking...@gmail.com wrote:

 On Thu, May 27, 2010 at 4:20 PM, Rico rico@gmail.com wrote:

 When you say default, do you mean it's the default setting in the app
 being launched, or the app that is launching?


 Default behavior for the Android system. Unless otherwise specified via
 launch mode flags, different intents result in different instances of an
 Activity, AFAIK.

 I've played around with launcher code samples that others have posted,

 and they don't do that.  Example:


 http://github.com/commonsguy/cw-advandroid/tree/master/Introspection/Launchalot/


 Don't do what? Result in different instances? I highly doubt you ran this
 from the Android Market or from the notification area, so how could you
 tell?


That app (Launchalot) is a launcher app (i.e. it just launches other apps).
 I'm not saying that Launchalot doesn't have multiple instances of itself
created if launched from the Market or notifications bar.  It probably does.
 What I'm saying is that when you launch apps through Launchalot, it doesn't
create multiple instances of the apps it's launching.  I was just trying to
point out that it should be possible for the Market to launch apps in the
same way as Launchalot same way and avoid this issue.



 I can see why the notification bar needs to behave differently from other
 launch points, but it seems me that the Market should not behave this way.


 I don't know, I didn't make the Market app =P


Thanks. I wasn't specifically directing that at you.  Rather, I was hoping
someone else who knows about the Market app could comment.



 -

 TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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] Is the native code which be generated by JIT Compiler portable?

2010-04-05 Thread yao-chih
Hi everyone,

I try to do something at Dalvik virtual machine

For the research purpose, I want to place the native code which be
generated by trace-based JIT compiler to the other place at runtime ,
and the new place is not at code cache.

But when i do this, I got some error like SIGILL or SIGSEGV

Is the native code position independent?? or I should do relocation
for the native code

thanks

yao-chih

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

To unsubscribe, reply using remove me as the subject.


[android-developers] How to remove a group membership with Android 2.0 contacts API?

2009-12-09 Thread Yao
Hi gurus,

I'm struggling with Android 2.0 contacts API. Could anyone give me a hint
how to delete a group membership with the new API? i.e. delete a contact
(id: 10) from a group (id: 2).

Your help is really appreciated! Thanks a lot in advance.

-- 
Best regards,
MTM
Contacts GroupU - Group your Android Contacts
http://contacts-groupu.appspot.com

-- 
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] Android market .... what's happening?

2009-11-18 Thread Yao
I met the same problem!

On Thu, Nov 19, 2009 at 12:30 PM, nubin...@gmail.com nubin...@gmail.comwrote:

 My app's total downloads dropped from 48000 to 789? Did Google just
 invent time machine?

 I have another app that has -8 active installs now.

 What's happening!

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Best regards,
MTM
Contacts GroupU - Group your Android Contacts
http://contacts-groupu.appspot.com

-- 
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] Group related code with new ContactsContract APIs?

2009-11-13 Thread Yao
Hi all,

I'm struggling with changed contacts APIs. Could anyone please give me an
example/clue how to achieve following functionality via code? Thanks a lot
in advance!!!

* Insert a group
* List all groups names
* List group members of a group



-- 
Best regards,
MTM
Contacts GroupU - Group your Android Contacts
http://contacts-groupu.appspot.com

-- 
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] [Android 2.0] Contacts FAQ?

2009-11-13 Thread Yao
Agreed! Some more questions, thanks!

11) How do I get add/delete/update a group?
12) How do I get members of a group?
13) How do I add a contact to a group?
14) How do I remove a contact from a group?

On Sat, Nov 14, 2009 at 8:21 AM, Rachel Blackman
ceruleanspa...@gmail.comwrote:

 So, judging from list traffic, there's... confusion, let's say, surrounding
 the Android 2.0 ContactsContract API.  Some parts of the new API are fairly
 straightforward, others?  Not so much.

 Look at the threads about How do I set a contact photo? or How do I
 create a new contact under 2.0, from within my app? (which, of course,
 leads into the whole Accounts thing) or What do I store as a single,
 consistent value to tie data in my app to a contact, now?  What's the
 reliable key into that data? or OMG WTF WHERE ARE THE PHONE NUMBERS?  I
 THINK LITTLE PHONE GOBLINS ATE THEM! or so on.

 (Well, maybe not the last one.)

 Some of the questions seem to occur over and over again.  I *still* can't
 set contact photos! Can someone show me how to get the phone numbers for a
 contact, hungry goblins notwithstanding?  Etc.  I therefore suggest that
 these qualify as FAQs.

 So, I'm going to suggest we as a community put together a quick list of
 Common Contact Operations (or Ones People Are Likely To Want), and put
 together some simple little tutorials which can be dumped somewhere on
 GoogleCode.

 The questions I see occurring a lot on a couple of web searches are:

 1) How do I just get ALL the contacts under the 2.0 API?

 2) Given a contact, how do I get all the phone numbers?

 3) Given a contact, how do I get all the email addresses?

 4) What sort of identifier should I represent a contact with in my local
 data, so I can later get their most-current data?

 5) How do I set a contact photo?

 6) How do I add a contact to the address book from within an app?

 7) How do I add custom data to a contact?

 8) How do I add an Account type, a'la Facebook, so that I can sync contact
 data in from MySpace/Livejournal/whatever.

 9) How do I /get/ the nifty status messages and the source for them (a'la
 'Away for lunch' on 'Google Talk,' or 'eating a pie!' on 'Facebook'), so I
 can display them alongside a contact in my own app?  (Alternatively, some
 ask how they can set the nifty status messages and have them appear in the
 QuickContact bar or in other apps.)

 10) How do I add an action to the QuickContact bar for a contact?

 1-7 seem to be the most-often-asked questions, but I've seen 8-10 around as
 well.  Does anyone else think that this would be worth putting together as a
 little reference and set of samples for 2.0?  Would anyone else be willing
 to pitch in and write one or two of the samples?  I figure, each of the
 items could be tackled as a short write-up individually (and I'll certainly
 do some as well, since I'm the one proposing this).  Maybe we can even get
 one or two of the Google folks to look at the samples when done and confirm
 that the methods used /are/ the best-practice ones. :)

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Best regards,
MTM
Contacts GroupU - Group your Android Contacts
http://contacts-groupu.appspot.com

-- 
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] [Android 2.0] Contacts FAQ?

2009-11-13 Thread Yao
Another important thing is that are new contact APIs stable and public? Will
they be changed in the next release?

I've been seeing this is a private method many times. Contacts APIs were
very stable before, but this time, new APIs  is a big change without any
document...

On Sat, Nov 14, 2009 at 10:38 AM, Dan Dumont ddum...@gmail.com wrote:

 To facilitate the discussion around #8, (android.accounts examples) I've
 started up a project over here:
 http://code.google.com/p/androidaccounts/

  http://code.google.com/p/androidaccounts/If anyone is interested in
 pitching in and writing some examples, let me know so I can add you.
 The current state of the project is as far as I've gotten to understanding
 what is available so far... and I'm stumped as to why new accounts don't
 seem to persist after their creation ( as far as the AccountsTester app is
 concerned ).

 On Fri, Nov 13, 2009 at 8:49 PM, Yao cicikaka2...@gmail.com wrote:

 Agreed! Some more questions, thanks!

 11) How do I get add/delete/update a group?
 12) How do I get members of a group?
 13) How do I add a contact to a group?
 14) How do I remove a contact from a group?


 On Sat, Nov 14, 2009 at 8:21 AM, Rachel Blackman 
 ceruleanspa...@gmail.com wrote:

 So, judging from list traffic, there's... confusion, let's say,
 surrounding the Android 2.0 ContactsContract API.  Some parts of the new API
 are fairly straightforward, others?  Not so much.

 Look at the threads about How do I set a contact photo? or How do I
 create a new contact under 2.0, from within my app? (which, of course,
 leads into the whole Accounts thing) or What do I store as a single,
 consistent value to tie data in my app to a contact, now?  What's the
 reliable key into that data? or OMG WTF WHERE ARE THE PHONE NUMBERS?  I
 THINK LITTLE PHONE GOBLINS ATE THEM! or so on.

 (Well, maybe not the last one.)

 Some of the questions seem to occur over and over again.  I *still*
 can't set contact photos! Can someone show me how to get the phone numbers
 for a contact, hungry goblins notwithstanding?  Etc.  I therefore suggest
 that these qualify as FAQs.

 So, I'm going to suggest we as a community put together a quick list of
 Common Contact Operations (or Ones People Are Likely To Want), and put
 together some simple little tutorials which can be dumped somewhere on
 GoogleCode.

 The questions I see occurring a lot on a couple of web searches are:

 1) How do I just get ALL the contacts under the 2.0 API?

 2) Given a contact, how do I get all the phone numbers?

 3) Given a contact, how do I get all the email addresses?

 4) What sort of identifier should I represent a contact with in my local
 data, so I can later get their most-current data?

 5) How do I set a contact photo?

 6) How do I add a contact to the address book from within an app?

 7) How do I add custom data to a contact?

 8) How do I add an Account type, a'la Facebook, so that I can sync
 contact data in from MySpace/Livejournal/whatever.

 9) How do I /get/ the nifty status messages and the source for them (a'la
 'Away for lunch' on 'Google Talk,' or 'eating a pie!' on 'Facebook'), so I
 can display them alongside a contact in my own app?  (Alternatively, some
 ask how they can set the nifty status messages and have them appear in the
 QuickContact bar or in other apps.)

 10) How do I add an action to the QuickContact bar for a contact?

 1-7 seem to be the most-often-asked questions, but I've seen 8-10 around
 as well.  Does anyone else think that this would be worth putting together
 as a little reference and set of samples for 2.0?  Would anyone else be
 willing to pitch in and write one or two of the samples?  I figure, each of
 the items could be tackled as a short write-up individually (and I'll
 certainly do some as well, since I'm the one proposing this).  Maybe we can
 even get one or two of the Google folks to look at the samples when done and
 confirm that the methods used /are/ the best-practice ones. :)

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Best regards,
 MTM
 Contacts GroupU - Group your Android Contacts
 http://contacts-groupu.appspot.com

  --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you

Re: [android-developers] Re: Working with the new ContactContracts API

2009-11-04 Thread Yao
Hi Dmitri,

Would you please help point out how's new group structure? Something similar
as groupmembership table in previous relese. Thanks a lot in advance!

On Thu, Nov 5, 2009 at 10:47 AM, Dmitri Plotnikov dplotni...@google.comwrote:

 Hi Jake,

 The database structure is actually extremely straightforward:

 Contacts represents an aggregated contact
 RawContacts represents a contact as it was inserted by the sync adapter.
  RawContact has a CONTACT_ID field that binds it to a Contact.
 Data represents everything about a RawContact: emails, phone numbers,
 notes, birthday, high school graduation year, you name it.  Data has a
 RAW_CONTACT_ID field that binds it a  RawContact.  The other important field
 is MIMETYPE.  That's what determines the kind of data stored in a Data row.
  Everything else is just convenience API.

 So here's the most common way of inserting a data row:

 values.put(Data.RAW_CONTACT_ID, rawContactId);
 values.put(Data.MIMETYPE, Note.CONTENT_ITEM_TYPE);
 values.put(Note.NOTE, Blah blah blah);
 resolver.insert(Data.CONTENT_URI, null, values);

 I hope this helps.

 - Dmitri


 On Wed, Nov 4, 2009 at 6:11 PM, jak. koda...@gmail.com wrote:

 Thank you Dmitri,

 Your response was very helpful. Along with that, and the sample you
 posted on another thread about using both Contact Apis from one app,
 I've gotten most of the way there. It is much appreciated.

 I'm still however having some problems that I'm hard pressed to find a
 solution for.
 I'd be grateful if anyone could help me.

 The biggest challenge I'm  having with this API is that it's hard for
 me to picture how the tables are laid out so I know which URI to query
 to get the parts of the contact that I'm interested in.
 I found to get the email address for a contact I'm looking at I can
 query the uri:ContactsContract.CommonDataKinds.Email.CONTENT_URI,
 looking at rows of the contact id i'm interested in.

 However to get the note from the same contact I can't use a similar
 pattern, because there is no
 ContactsContract.CommonDataKinds.Note.CONTENT_URI
 The Note type exists in CommonDataKinds but it doesn't have an
 associated CONTENT_URI.

 I'm finding it very frustrating to use this API because every time I
 go to try to pull out another piece of data from the contact, the
 method to access it seems to change (as I can't find a consistent way
 to get a given field from a contact). And the documentation never
 describes how these keys, tables, and URIs are related. Basically the
 ContactsContract documentation just gives you a giant list of Objects
 containing constants that describe indexes into some database that is
 basically a black box without some basic documentation.

 I'm I the only one that finds this frustrating?

 Thanks again for your help.

 -Jake

 On Nov 2, 5:24 pm, Dmitri Plotnikov dplotni...@google.com wrote:
  You can always delegate contact creation to the Contacts app using the
  ContactsContract.Intents.UI.Insert intent with extras. This will show
 the
  edit UI.
 
  If you want to explicitly create the contact by yourself, that's now a
 bit
  tricky because Android 2.0 support multiple accounts.
 
  First of all, you will need to figure out which account you want to
 create
  the contact in. Get a list of all available accounts from
 AccountManager:
 
  AccountManager am = AccountManager.get(getContext());
  Account[] accounts = am.getAccounts();
 
  Also, get a list of all sync adapters and find the ones that support
  contacts:
 
  SyncAdapterType[] syncs
  = ContentResolver.getContentService().getSyncAdapterTypes();
 
  for (SyncAdapterType sync : syncs) {
   if (ContactsContract.AUTHORITY.equals(sync.authority) 
  sync.supportsUploading()) {
contactAccountTypes.add(sync.accountType);
   }
 
  }
 
  Now you have a list of all accounts and a list of account types that
 support
  contacts.  So here's your account list:
 
  for (Account acct: accounts) {
 if (contactAccountTypes.contains(acct.type)) {
contactAccounts.add(account);
 }
 
  }
 
  If the contactAccounts list contains nothing - use accountType = null
 and
  accountName = null
  If it contains exactly one account, use it.
  If it contains multiple accounts, build a dialog and ask the user which
  account to use.
 
  From here on it gets easier.
 
  Let's start with a more traditional method.  Insert a raw contact first:
 
  ContentValues values = new ContentValues();
  values.put(RawContacts.ACCOUNT_TYPE, accountType);
  values.put(RawContacts.ACCOUNT_NAME, accountName);
  Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI,
  values);
  long rawContactId = ContentUris.parseId(rawContactUri);
 
  Then insert the name:
 
  values.clear();
  values.put(Data.RAW_CONTACT_ID, rawContactId);
  values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
  values.put(StructuredName.DISPLAY_NAME, Some Body);
  getContentResolver().insert(Data.CONTENT_URI, values);
 
  You are done.
 
  Now 

[android-developers] Re: Can't query contacts in Android 2.0 emulator?

2009-10-30 Thread Yao
On Fri, Oct 30, 2009 at 7:25 PM, agirardello andrea.girarde...@gmail.comwrote:


 Try to use:

 android.provider.ContactsContract.Contacts.CONTENT_URI


It works. Thanks!




 On Oct 28, 7:10 am, Yao cicikaka2...@gmail.com wrote:
  Hi guys,
 
  I can't get contacts via content provider in Android 2.0 emulator. The
 test
  code is pasted. When I click Account in the menu, it shows Force
 close.
  Thanks a lot in advance for your help!
 
 Cursor cursor =
 getContentResolver().query(Contacts.People.CONTENT_URI,
  new String[] {_id}, null, null, null);
  while(cursor.moveToNext()) {
  String id = cursor.getString(0);
  Log.e(test, id);
  }
  cursor.close();
 
  --
  Best regards,
  MTM
  Contacts GroupU - Group your Android Contactshttp://
 contacts-groupu.appspot.com
 



-- 
Best regards,
MTM
Contacts GroupU - Group your Android Contacts
http://contacts-groupu.appspot.com

--~--~-~--~~~---~--~~
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] Can't query contacts in Android 2.0 emulator?

2009-10-28 Thread Yao
Hi guys,

I can't get contacts via content provider in Android 2.0 emulator. The test
code is pasted. When I click Account in the menu, it shows Force close.
Thanks a lot in advance for your help!

   Cursor cursor = getContentResolver().query(Contacts.People.CONTENT_URI,
new String[] {_id}, null, null, null);
while(cursor.moveToNext()) {
String id = cursor.getString(0);
Log.e(test, id);
}
cursor.close();

-- 
Best regards,
MTM
Contacts GroupU - Group your Android Contacts
http://contacts-groupu.appspot.com

--~--~-~--~~~---~--~~
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] Can't query contacts in Android 2.0 emulator?

2009-10-28 Thread Yao
Hi guys,

I can't get contacts via content provider in Android 2.0 emulator. The test
code is pasted. When I click Account in the menu, it shows Force close.
Thanks a lot in advance for your help!

   Cursor cursor = getContentResolver().query(Contacts.People.CONTENT_URI,
new String[] {_id}, null, null, null);
while(cursor.moveToNext()) {
String id = cursor.getString(0);
Log.e(test, id);
}
cursor.close();

-- 
Best regards,
MTM
Contacts GroupU - Group your Android Contacts
http://contacts-groupu.appspot.com

--~--~-~--~~~---~--~~
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: ambiguous column name: _id when querying the contacts list

2009-08-13 Thread yao chen
On Thu, Aug 13, 2009 at 3:15 PM, Jeff Sharkey jshar...@android.com wrote:


 Ouch, there isn't a good solution in the current SDK.  In Eclair we're
 restructuring this code, which would break the people._id solution
 you mentioned.  :(  And you're right, there otherwise isn't a good way
 of selecting multiple _ids.


Ouch... I met the same problem. So is it possible to maintain a version
working for both sdk?



 Ironically, the same change that breaks the people._id approach also
 fixes the _id ambiguity problem, lol.

 I'm afraid the answer is to use people._id for now, and update it
 when the Eclair SDK is released.

 j

 On Wed, Aug 12, 2009 at 5:22 PM, whaledawgwhaled...@gmail.com wrote:
 
  So I have a bit of code that takes a list of contact ID's that have
  been selected and return a cursor with other data I might be
  interested in for those ID's
 
  protected Cursor collectUserData(ArrayListInteger friends)
  {
   String[] PROJECTION=new String[] { Contacts.People._ID,
 
  Contacts.PeopleColumns.DISPLAY_NAME   };
   String WHERE = new String();
   WHERE += Contacts.People._ID;
   WHERE +=   IN (;
   for(int i = 0; i  friends.size(); i++)
   {
 WHERE += friends.get(i).toString();
 if(i  friends.size() - 1)
 {
  WHERE += ,;
  }
  else
  {
 WHERE += );
  }
   }
   return managedQuery(Contacts.People.CONTENT_URI, PROJECTION, WHERE,
  null,
 
  Contacts.People.DEFAULT_SORT_ORDER);
  }
 
  And this code gives me the following error:
  #
  08-12 15:49:53.013: ERROR/DatabaseUtils(102): Writing exception to
  parcel
  #
  08-12 15:49:53.013: ERROR/DatabaseUtils(102):
  android.database.sqlite.SQLiteException: ambiguous column name: _id: ,
  while compiling: SELECT people._id AS _id, (CASE WHEN (name IS NOT
  NULL AND name != '') THEN name ELSE (CASE WHEN primary_organization is
  NOT NULL THEN (SELECT company FROM organizations WHERE
  organizations._id = primary_organization) ELSE (CASE WHEN
  primary_phone IS NOT NULL THEN (SELECT number FROM phones WHERE
  phones._id = primary_phone) ELSE (CASE WHEN primary_email IS NOT NULL
  THEN (SELECT data FROM contact_methods WHERE contact_methods._id =
  primary_email) ELSE null END) END) END) END)  AS display_name FROM
  people LEFT OUTER JOIN phones ON people.primary_phone=phones._id LEFT
  OUTER JOIN presence ON (presence.person=people._id) WHERE (_id  IN
  (20)) ORDER BY name ASC
 
  I can get rid of the error if I change the WHERE clause to start  like
  this instead:
  String WHERE = new String();
  WHERE += people._id;
 
  But this seems a little brittle. How should I be doing this query?
 
  
 



 --
 Jeff Sharkey
 jshar...@android.com

 


--~--~-~--~~~---~--~~
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 to download a read only sqlite database at runtime

2009-08-13 Thread yao chen
On Fri, Aug 14, 2009 at 7:59 AM, trev tre...@shartrec.com wrote:


 My application needs to download a reasonably sized SQLite database at
 runtime, depending on the location of the user.  On a remote server I
 will have many databases for various regions around the globe and
 would like to download the database file, but can't quite work out
 what steps are required.  It doesn't seem that I can open a database
 file for writing to directly.


You can write it as common file by using file operation APIs.




 


--~--~-~--~~~---~--~~
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] Contacts GroupU - easily manage your contacts

2009-08-13 Thread Yao
Hi guys,

Contacts GroupU is an application which manages group of contacts. It
integrates with built-in phonebook seamlessly. All groups edited in GroupU
will appear in phonebook, and can be synced with gmail group setting. With
GroupU, user can send sms/mms/email to a group, or multiple group members.
One contact can be assoicated with multiple groups.

You can find more details by downloading GroupU from MarketPlace. Enjoy it!

Best Regards,
Yao

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