[android-developers] Lazy loading in HorizontalScrollView to prevent Out of Memory issue

2011-08-26 Thread himanshu jain
I want to add lazy loading feature to HorizontalScrollView, It has
linearlayout as a child and i am addding to linearlayout,

I am interested in listening to the event when the child view is out
of the visibility area,  I see in linearlayout implementation it does
not call either dispatchViewVisibility or onDraw on child view , why i
want that because bitmap attached to the child view can be recycled
and create bitmap again when child view is visible (well that is a
separate part ,How can i create that bitmap very fast, I am planning
to use opengl for that) but the question is how can make such custom
view.

I can not use gallery view because it does not solve my purpose

I saw that viewgroup has feature of dispatchingViewVisibility and
dispatchOnDraw but not sure how to use that with
HorizontalScrollView.?

All i am doing to prevent Out of Memory issue


Any suggestion and help would be appreciated

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: Lazy loading in HorizontalScrollView to prevent Out of Memory issue

2011-08-26 Thread himanshu jain
@Drezden

Your correct i am using larger number of images added as child view of
LinearLayout which  is a child view of HorizontalScrollView,
Like OOM issue is happening at different number of images decoded from
BitmapFactory on different devices like Google Nexus it is after 160
images , Xoom 253 images and so on.

For decoding i am already using options and calculating inSampleSize
only not inTempStorage(will it add any improvement if i use it?).

Also i have cache that has soft reference to improve efficiency in
terms of number of images decoded because i am recycling bitmap, but
eventually it will crash due to OOM.


thanks



On Aug 26, 8:42 am, Drezden mmjohns...@gmail.com wrote:
 Are you loading a large number of images into your
 HorizontalScrollView?

 If so, then you are probably running out of memory from the Bitmap
 creation process.  You need to subsample them so you aren't loading
 billboard sized images into your app, like this.

 BitmapFactory.Options options = new BitmapFactory.Options();
 options.inSampleSize = 2;
 options.inTempStorage = new byte[16*1024];

 Bitmap img =
 BitmapFactory.decodeStream(getContentResolver().openInputStream(imagePath), 
 null,options);

 On Aug 26, 1:00 am, himanshu jain himanshu@gmail.com wrote:







  I want to add lazy loading feature to HorizontalScrollView, It has
  linearlayout as a child and i am addding to linearlayout,

  I am interested in listening to the event when the child view is out
  of the visibility area,  I see in linearlayout implementation it does
  not call either dispatchViewVisibility or onDraw on child view , why i
  want that because bitmap attached to the child view can be recycled
  and create bitmap again when child view is visible (well that is a
  separate part ,How can i create that bitmap very fast, I am planning
  to use opengl for that) but the question is how can make such custom
  view.

  I can not use gallery view because it does not solve my purpose

  I saw that viewgroup has feature of dispatchingViewVisibility and
  dispatchOnDraw but not sure how to use that with
  HorizontalScrollView.?

  All i am doing to prevent Out of Memory issue

  Any suggestion and help would be appreciated

  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] Android bug/issue on IPv6

2011-05-04 Thread himanshu jain
Hi all,

I am not sure as Google mentioned IPv6 support is available on
Android
1.6 or up , but i checked with 2.2 it even does not have link local
IPv6 address whereas 3.0 has that.


I tried to set up an environment to generate gloabal IPv6 but DHCP
can
assign IPv6 to other client except 3.0 HoneyComb which may have bug
in
native code ?.


When i got gloabal IPv6 address from server i still not able to
connect it says network unreachable ?.


Any suggestion


-- 
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: Java layer on Android SDK supports connection through IPv6 link local address???

2011-05-03 Thread himanshu jain
Hi all,

I am not sure as Google mentioned IPv6 support is available on Android
1.6 or up , but i checked with 2.2 it even does not have link local
IPv6 address whereas 3.0 has that.

I tried to set up an environment to generate gloabal IPv6 but DHCP can
assign IPv6 to other client except 3.0 HoneyComb which may have bug in
native code ?.

When i got gloabal IPv6 address from server i still not able to
connect it says network unreachable ?.


Any suggestion

On May 2, 3:28 pm, himanshu jain himanshu@gmail.com wrote:
 Hi,

 I am not able to connect Android client running on 3.0 HoneyComb to
 server sendingIPv6packet havingLink-localIPv6address.

 Does JAVA layer on android supports connection usinglink-local
 address forIPv6?.

-- 
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] Java layer on Android SDK supports connection through IPv6 link local address???

2011-05-02 Thread himanshu jain
Hi,

I am not able to connect Android client running on 3.0 HoneyComb to
server sending IPv6 packet having Link-local IPv6 address.

Does JAVA layer on android supports connection using link-local
address for IPv6?.

-- 
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] java.net.SocketException: The socket level is invalid when trying to connect using IPV6

2011-04-29 Thread himanshu jain
Getting this exception when client trying to connect server using ipv6
address , server supports ipv6 and client is android 2.2 os

04-29 10:14:38.630: WARN/System.err(22896): java.net.SocketException:
The socket level is invalid
04-29 10:14:38.630: WARN/System.err(22896): at
org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocketImpl(Native
Method)
04-29 10:14:38.630: WARN/System.err(22896): at
org.apache.harmony.luni.platform.OSNetworkSystem.connectStreamWithTimeoutSocket(OSNetworkSystem.java:
130)
04-29 10:14:38.630: WARN/System.err(22896): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
246)
04-29 10:14:38.630: WARN/System.err(22896): at
org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:
219)
04-29 10:14:38.630: WARN/System.err(22896): at
java.net.Socket.startupSocket(Socket.java:800)
04-29 10:14:38.630: WARN/System.err(22896): at
java.net.Socket.tryAllAddresses(Socket.java:194)
04-29 10:14:38.630: WARN/System.err(22896): at
java.net.Socket.init(Socket.java:258)
04-29 10:14:38.630: WARN/System.err(22896): at
java.net.Socket.init(Socket.java:222)
04-29 10:14:38.630: WARN/System.err(22896): at
javax.net.ssl.SSLSocket.init(SSLSocket.java:56)
04-29 10:14:38.630: WARN/System.err(22896): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.init(OpenSSLSocketImpl.java:
174)
04-29 10:14:38.634: WARN/System.err(22896): at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl.createSocket(OpenSSLSocketFactoryImpl.java:
65)

-- 
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: DalvikVm issue

2011-04-28 Thread himanshu jain
@Indicator

 There is not any support for doing certificate creation directly in
the JCA?

How can i create my own certificate and signed it?

thanks


On Apr 26, 3:32 pm, Indicator Veritatis mej1...@yahoo.com wrote:
 javax.crypto alone is not enough, unless he wants to do a lot of extra
 work himself setting up the certificate fields and signing it. How to
 do all this with other classes in the Java security API is described
 in some detail 
 athttp://download.oracle.com/javase/6/docs/technotes/guides/security/cr

 I didn't see any classes in their that are missing from Android Java,
 but I have to admit I did not check that thoroughly. I did at least
 check that MessageDigest is supported: it is in the android.security
 package in Android Java.

 On Apr 26, 1:32 pm, Mark Murphy mmur...@commonsware.com wrote:



  On Tue, Apr 26, 2011 at 4:22 PM, himanshu jain himanshu@gmail.com 
  wrote:
   Thats true i am using BC 145 earlier and now trying to use 146 , but
   if i stick to javax.crypto then how would i generate self signed
   certificate?.

  I haven't used javax.crypto much, personally.

   Can we come to know what all classes from BC included in the android
   firmware ?.

  :: shrug ::

  You are welcome to putter throughhttp://source.android.com, but the
  mix of classes may change.

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

  Warescription: Three Android Books, Plus Updates, One Low Price!- Hide 
  quoted text -

 - Show quoted text -

-- 
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] DalvikVm issue

2011-04-26 Thread himanshu jain
04-26 12:38:09.003: WARN/dalvikvm(13579): VFY: unable to resolve
exception class 347 (Lorg/bouncycastle/operator/
OperatorCreationException;)
04-26 12:38:09.003: WARN/dalvikvm(13579): VFY: unable to find
exception handler at addr 0x15f
04-26 12:38:09.003: WARN/dalvikvm(13579): VFY:  rejected Lcom/
mycompany/applicationpairing/Connector;.run ()V
04-26 12:38:09.003: WARN/dalvikvm(13579): VFY:  rejecting opcode 0x0d
at 0x015f
04-26 12:38:09.003: WARN/dalvikvm(13579): VFY:  rejected Lcom/
mycompany/applicationpairing/Connector;.run ()V
04-26 12:38:09.003: WARN/dalvikvm(13579): Verifier rejected class Lcom/
mycompany/applicationpairing/Connector;

I have jar file on my build path and it has class and method but still
dalvik vm show VFY warning and error

any gottcha !!

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: DalvikVm issue

2011-04-26 Thread himanshu jain
Hey Mark,

Thats true i am using BC 145 earlier and now trying to use 146 , but
if i stick to javax.crypto then how would i generate self signed
certificate?.
Can we come to know what all classes from BC included in the android
firmware ?.

Strange thing is i am using BC 145 it does not complain if i use
deprecated methods once i change to specified method like generate
method in X509V3CertificateGenerator it complains any idea ?


thanks a lot



On Apr 26, 12:54 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Tue, Apr 26, 2011 at 3:40 PM, himanshu jain himanshu@gmail.com wrote:
  04-26 12:38:09.003: WARN/dalvikvm(13579): VFY: unable to resolve
  exception class 347 (Lorg/bouncycastle/operator/
  OperatorCreationException;)
  04-26 12:38:09.003: WARN/dalvikvm(13579): VFY: unable to find
  exception handler at addr 0x15f
  04-26 12:38:09.003: WARN/dalvikvm(13579): VFY:  rejected Lcom/
  mycompany/applicationpairing/Connector;.run ()V
  04-26 12:38:09.003: WARN/dalvikvm(13579): VFY:  rejecting opcode 0x0d
  at 0x015f
  04-26 12:38:09.003: WARN/dalvikvm(13579): VFY:  rejected Lcom/
  mycompany/applicationpairing/Connector;.run ()V
  04-26 12:38:09.003: WARN/dalvikvm(13579): Verifier rejected class Lcom/
  mycompany/applicationpairing/Connector;

  I have jar file on my build path and it has class and method but still
  dalvik vm show VFY warning and error

 If the jar file on my build path is the Legion of the Bouncy Castle
 library, that is part of the firmware, and so you will likely
 encounter problems when using it. If possible, stick to the
 javax.crypto classes, which use Bouncy Castle behind the scenes.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Warescription: Three Android Books, Plus Updates, One Low Price!- Hide quoted 
 text -

 - Show quoted text -

-- 
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: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-02-03 Thread himanshu jain
Hi Dmitri,

right now i am doing iterative development on emulator , i will later
deploy it on actual device.

I come across one issue if i call addAccount() from account manager as
per the documentation my authenticator addAccount() does not get
invoked although authenticar service and authenticator associated with
that properly defined in the manifest.

can you tell me what could be the issue ??.

thanks


On Feb 1, 1:51 pm, Dmitri Plotnikov dplotni...@google.com wrote:
 All that stuff about duplicates looks a bit suspicious.  I would try to
 uninstall all extra sync adapters.

 On Tue, Feb 1, 2011 at 10:56 AM, himanshu jain himanshu@gmail.comwrote:







  here is the log accord according to Plan A and Plan B when i have
  SampleSyncAdapater running on Device A-OS 2.2

  01-31 21:02:06.105: VERBOSE/SyncManager(206): [SyncManager.java:
  653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
  01-31 21:02:06.145: DEBUG/SyncManager(206): [SyncManager.java:
  607:scheduleSync()] scheduleSync: sync of Account {name=username,
  type=com.example.android.samplesync}, com.android.contacts is not
  allowed, dropping request
  01-31 21:02:06.165: VERBOSE/SyncManager(206): [SyncStorageEngine.java:
  374:reportChange()] reportChange 1 to: [android.content.SyncManager
  $7@313452f8, android.content.ContentResolver$1@314960c8]
  01-31 21:02:06.175: VERBOSE/SyncManager(206): [SyncManager.java:
  653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
  01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncManager.java:
  614:scheduleSync()] scheduleSync: delay 0, source 0, account Account
  {name=username, type=com.example.android.samplesync}, authority
  com.android.contacts, extras Bundle[{}]
  01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncManager.java:
  786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
  sync operation authority: com.android.contacts account: Account
  {name=username, type=com.example.android.samplesync} extras: []
  syncSource: 0 when: 319845221 expedited: false
  01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncStorageEngine.java:
  374:reportChange()] reportChange 1 to: [android.content.SyncManager
  $7@313452f8, android.content.ContentResolver$1@314960c8]
  01-31 21:02:06.255: VERBOSE/SyncManager(206): [SyncManager.java:
  653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
  01-31 21:02:06.325: VERBOSE/SyncManager(206): [SyncManager.java:
  614:scheduleSync()] scheduleSync: delay 0, source 2, account Account
  {name=Backup Assistant, type=com.fusionone.account}, authority
  com.android.contacts, extras Bundle[{}]
  01-31 21:02:06.335: VERBOSE/SyncManager(206): [SyncManager.java:
  786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
  sync operation authority: com.android.contacts account: Account
  {name=Backup Assistant, type=com.fusionone.account} extras: []
  syncSource: 2 when: 319845328 expedited: false
  01-31 21:02:06.385: VERBOSE/SyncManager(206): [SyncManager.java:
  614:scheduleSync()] scheduleSync: delay 0, source 2, account Account
  {name=username, type=com.example.android.samplesync}, authority
  com.android.contacts, extras Bundle[{}]
  01-31 21:02:06.395: VERBOSE/SyncManager(206): [SyncManager.java:
  786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
  sync operation authority: com.android.contacts account: Account
  {name=username, type=com.example.android.samplesync} extras: []
  syncSource: 2 when: 319845375 expedited: false
  01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
  786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
  sync operation authority: com.android.contacts account: Account
  {name=username, type=com.example.android.samplesync} extras: []
  syncSource: 4 when: 319845416 expedited: false
  01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
  1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS
  01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
  1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS
  01-31 21:02:06.435: VERBOSE/SyncManager(206): [SyncManager.java:
  1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS

  On Jan 31, 6:00 pm, Dmitri Plotnikov dplotni...@google.com wrote:
   I cannot spot anything obviously wrong here.

   Here's what I would do in this situation:

   Plan A: Closely examine the logs - there might be something there
  already.
    Enable more logging and see if you can glean anything from it:

   adb shell setprop log.tag.SyncManager VERBOSE

   Plan B: I would put aside the sync adapter that you wrote, take
   SampleSyncAdapter, make sure it works on the device, and then start
  morphing
   it into what you need, making small incremental changes and retesting
  until
   it stops working.  Then you know where you made a mistake.

   Plan C: I would get Android source and step through it in the debugger.
    SyncManager

[android-developers] Re: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-02-03 Thread himanshu jain
Ignore previous question i figured out what was the problem !! thanks

Can you suggest me do i really need to use Editor activity for showing
all contact fields to user or i can utilize contact app native
editor , i was wondering why by default app shows only two field first
name and last name?.

thanks
Dmitri

On Feb 3, 1:07 pm, himanshu jain himanshu@gmail.com wrote:
 Hi Dmitri,

 right now i am doing iterative development on emulator , i will later
 deploy it on actual device.

 I come across one issue if i call addAccount() from account manager as
 per the documentation my authenticator addAccount() does not get
 invoked although authenticar service and authenticator associated with
 that properly defined in the manifest.

 can you tell me what could be the issue ??.

 thanks

 On Feb 1, 1:51 pm, Dmitri Plotnikov dplotni...@google.com wrote:







  All that stuff about duplicates looks a bit suspicious.  I would try to
  uninstall all extra sync adapters.

  On Tue, Feb 1, 2011 at 10:56 AM, himanshu jain 
  himanshu@gmail.comwrote:

   here is the log accord according to Plan A and Plan B when i have
   SampleSyncAdapater running on Device A-OS 2.2

   01-31 21:02:06.105: VERBOSE/SyncManager(206): [SyncManager.java:
   653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
   01-31 21:02:06.145: DEBUG/SyncManager(206): [SyncManager.java:
   607:scheduleSync()] scheduleSync: sync of Account {name=username,
   type=com.example.android.samplesync}, com.android.contacts is not
   allowed, dropping request
   01-31 21:02:06.165: VERBOSE/SyncManager(206): [SyncStorageEngine.java:
   374:reportChange()] reportChange 1 to: [android.content.SyncManager
   $7@313452f8, android.content.ContentResolver$1@314960c8]
   01-31 21:02:06.175: VERBOSE/SyncManager(206): [SyncManager.java:
   653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
   01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncManager.java:
   614:scheduleSync()] scheduleSync: delay 0, source 0, account Account
   {name=username, type=com.example.android.samplesync}, authority
   com.android.contacts, extras Bundle[{}]
   01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncManager.java:
   786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
   sync operation authority: com.android.contacts account: Account
   {name=username, type=com.example.android.samplesync} extras: []
   syncSource: 0 when: 319845221 expedited: false
   01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncStorageEngine.java:
   374:reportChange()] reportChange 1 to: [android.content.SyncManager
   $7@313452f8, android.content.ContentResolver$1@314960c8]
   01-31 21:02:06.255: VERBOSE/SyncManager(206): [SyncManager.java:
   653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
   01-31 21:02:06.325: VERBOSE/SyncManager(206): [SyncManager.java:
   614:scheduleSync()] scheduleSync: delay 0, source 2, account Account
   {name=Backup Assistant, type=com.fusionone.account}, authority
   com.android.contacts, extras Bundle[{}]
   01-31 21:02:06.335: VERBOSE/SyncManager(206): [SyncManager.java:
   786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
   sync operation authority: com.android.contacts account: Account
   {name=Backup Assistant, type=com.fusionone.account} extras: []
   syncSource: 2 when: 319845328 expedited: false
   01-31 21:02:06.385: VERBOSE/SyncManager(206): [SyncManager.java:
   614:scheduleSync()] scheduleSync: delay 0, source 2, account Account
   {name=username, type=com.example.android.samplesync}, authority
   com.android.contacts, extras Bundle[{}]
   01-31 21:02:06.395: VERBOSE/SyncManager(206): [SyncManager.java:
   786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
   sync operation authority: com.android.contacts account: Account
   {name=username, type=com.example.android.samplesync} extras: []
   syncSource: 2 when: 319845375 expedited: false
   01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
   786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
   sync operation authority: com.android.contacts account: Account
   {name=username, type=com.example.android.samplesync} extras: []
   syncSource: 4 when: 319845416 expedited: false
   01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
   1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS
   01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
   1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS
   01-31 21:02:06.435: VERBOSE/SyncManager(206): [SyncManager.java:
   1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS

   On Jan 31, 6:00 pm, Dmitri Plotnikov dplotni...@google.com wrote:
I cannot spot anything obviously wrong here.

Here's what I would do in this situation:

Plan A: Closely examine the logs - there might be something there
   already.
 Enable more logging and see if you can glean anything

[android-developers] Re: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-02-01 Thread himanshu jain
Thanks Dmitri

Plan A showing logs but still service not gets invoked

Plan B i tried to put SampleSyncAdapter totally unchanged except i
have to cheat for this line only
 ((AuthenticatorActivity) context).onAuthenticationResult(true) in
NetworkUtilities rest all intact but still this one does not start
SyncAdapter.


Plan C i am working on it lets see what can i figure out ..


Please all tell me calling requesSync immediately call onPerformSync
or again SyncManager puts request in Queue n later invoke my adapter
is that true ??. If this is the case then i have to design in way so
that on pressing button Sync should start immediately

thanks

On Jan 31, 6:00 pm, Dmitri Plotnikov dplotni...@google.com wrote:
 I cannot spot anything obviously wrong here.

 Here's what I would do in this situation:

 Plan A: Closely examine the logs - there might be something there already.
  Enable more logging and see if you can glean anything from it:

 adb shell setprop log.tag.SyncManager VERBOSE

 Plan B: I would put aside the sync adapter that you wrote, take
 SampleSyncAdapter, make sure it works on the device, and then start morphing
 it into what you need, making small incremental changes and retesting until
 it stops working.  Then you know where you made a mistake.

 Plan C: I would get Android source and step through it in the debugger.
  SyncManager is a complicated class, so it will take you a few minutes to
 figure out.  But in the end it's just Java.  If you can write Java, you can
 read Java.

 I hope this helps,
 - Dmitri

 On Mon, Jan 31, 2011 at 5:19 PM, himanshu jain himanshu@gmail.comwrote:







  this is my manifest file

  manifest xmlns:android=http://schemas.android.com/apk/res/android;
       package=org.c99.SyncProviderDemo
       android:versionCode=1
       android:versionName=1.0

  uses-permission
         android:name=android.permission.GET_ACCOUNTS /
     uses-permission
         android:name=android.permission.USE_CREDENTIALS /
     uses-permission
         android:name=android.permission.MANAGE_ACCOUNTS /
     uses-permission
         android:name=android.permission.AUTHENTICATE_ACCOUNTS /
     uses-permission
         android:name=android.permission.INTERNET /
     uses-permission
         android:name=android.permission.WRITE_SETTINGS /
     uses-permission
         android:name=android.permission.WRITE_SECURE_SETTINGS /
     uses-permission
         android:name=android.permission.READ_CONTACTS /
     uses-permission
         android:name=android.permission.WRITE_CONTACTS /
     uses-permission
         android:name=android.permission.READ_SYNC_STATS /
     uses-permission
         android:name=android.permission.READ_SYNC_SETTINGS /
     uses-permission
         android:name=android.permission.WRITE_SYNC_SETTINGS /

     application android:icon=@drawable/icon android:label=@string/
  app_name
         activity android:name=.LoginActivity
                   android:label=@string/app_name
             intent-filter
                 action android:name=android.intent.action.VIEW /
             /intent-filter
         /activity
                 activity android:name=.ProfileActivity
                                         android:label=Profile
                         intent-filter
                                 action
  android:name=android.intent.action.VIEW /
                                 category
  android:name=android.intent.category.DEFAULT /
                                 data
  android:mimeType=vnd.android.cursor.item/
  vnd.org.c99.SyncProviderDemo.profile /
                         /intent-filter
                 /activity
                 service android:name=.AccountAuthenticatorService
                         android:exported=true
                         intent-filter
                                 action
  android:name=android.accounts.AccountAuthenticator /
                         /intent-filter
                         meta-data
  android:name=android.accounts.AccountAuthenticator
                                 android:resource=@xml/authenticator /
                 /service
                 service android:name=.ContactsSyncAdapterService
                         android:exported=true 
                         intent-filter
                                 action
  android:name=android.content.SyncAdapter /
                         /intent-filter
                         meta-data
  android:name=android.content.SyncAdapter
                                 android:resource=@xml/syncadapter /
                         meta-data
  android:name=android.provider.CONTACTS_STRUCTURE
                                 android:resource=@xml/contacts /
                 /service

     /application
     uses-sdk android:minSdkVersion=5 /

  /manifest

  thanks

  On Jan 31, 4:53 pm, Dmitri Plotnikov dplotni...@google.com wrote:
   I would double-check every line of AndroidManifest.xml, compare it with
  the
   one in SampleSyncAdapter to see if anything's missing

[android-developers] Re: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-02-01 Thread himanshu jain
here is the log accord according to Plan A and Plan B when i have
SampleSyncAdapater running on Device A-OS 2.2

01-31 21:02:06.105: VERBOSE/SyncManager(206): [SyncManager.java:
653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
01-31 21:02:06.145: DEBUG/SyncManager(206): [SyncManager.java:
607:scheduleSync()] scheduleSync: sync of Account {name=username,
type=com.example.android.samplesync}, com.android.contacts is not
allowed, dropping request
01-31 21:02:06.165: VERBOSE/SyncManager(206): [SyncStorageEngine.java:
374:reportChange()] reportChange 1 to: [android.content.SyncManager
$7@313452f8, android.content.ContentResolver$1@314960c8]
01-31 21:02:06.175: VERBOSE/SyncManager(206): [SyncManager.java:
653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncManager.java:
614:scheduleSync()] scheduleSync: delay 0, source 0, account Account
{name=username, type=com.example.android.samplesync}, authority
com.android.contacts, extras Bundle[{}]
01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncManager.java:
786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
sync operation authority: com.android.contacts account: Account
{name=username, type=com.example.android.samplesync} extras: []
syncSource: 0 when: 319845221 expedited: false
01-31 21:02:06.235: VERBOSE/SyncManager(206): [SyncStorageEngine.java:
374:reportChange()] reportChange 1 to: [android.content.SyncManager
$7@313452f8, android.content.ContentResolver$1@314960c8]
01-31 21:02:06.255: VERBOSE/SyncManager(206): [SyncManager.java:
653:sendCheckAlarmsMessage()] sending MESSAGE_CHECK_ALARMS
01-31 21:02:06.325: VERBOSE/SyncManager(206): [SyncManager.java:
614:scheduleSync()] scheduleSync: delay 0, source 2, account Account
{name=Backup Assistant, type=com.fusionone.account}, authority
com.android.contacts, extras Bundle[{}]
01-31 21:02:06.335: VERBOSE/SyncManager(206): [SyncManager.java:
786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
sync operation authority: com.android.contacts account: Account
{name=Backup Assistant, type=com.fusionone.account} extras: []
syncSource: 2 when: 319845328 expedited: false
01-31 21:02:06.385: VERBOSE/SyncManager(206): [SyncManager.java:
614:scheduleSync()] scheduleSync: delay 0, source 2, account Account
{name=username, type=com.example.android.samplesync}, authority
com.android.contacts, extras Bundle[{}]
01-31 21:02:06.395: VERBOSE/SyncManager(206): [SyncManager.java:
786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
sync operation authority: com.android.contacts account: Account
{name=username, type=com.example.android.samplesync} extras: []
syncSource: 2 when: 319845375 expedited: false
01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
786:scheduleSyncOperation()] scheduleSyncOperation: dropping duplicate
sync operation authority: com.android.contacts account: Account
{name=username, type=com.example.android.samplesync} extras: []
syncSource: 4 when: 319845416 expedited: false
01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS
01-31 21:02:06.425: VERBOSE/SyncManager(206): [SyncManager.java:
1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS
01-31 21:02:06.435: VERBOSE/SyncManager(206): [SyncManager.java:
1473:handleMessage()] handleSyncHandlerMessage: MESSAGE_CHECK_ALARMS

On Jan 31, 6:00 pm, Dmitri Plotnikov dplotni...@google.com wrote:
 I cannot spot anything obviously wrong here.

 Here's what I would do in this situation:

 Plan A: Closely examine the logs - there might be something there already.
  Enable more logging and see if you can glean anything from it:

 adb shell setprop log.tag.SyncManager VERBOSE

 Plan B: I would put aside the sync adapter that you wrote, take
 SampleSyncAdapter, make sure it works on the device, and then start morphing
 it into what you need, making small incremental changes and retesting until
 it stops working.  Then you know where you made a mistake.

 Plan C: I would get Android source and step through it in the debugger.
  SyncManager is a complicated class, so it will take you a few minutes to
 figure out.  But in the end it's just Java.  If you can write Java, you can
 read Java.

 I hope this helps,
 - Dmitri

 On Mon, Jan 31, 2011 at 5:19 PM, himanshu jain himanshu@gmail.comwrote:







  this is my manifest file

  manifest xmlns:android=http://schemas.android.com/apk/res/android;
       package=org.c99.SyncProviderDemo
       android:versionCode=1
       android:versionName=1.0

  uses-permission
         android:name=android.permission.GET_ACCOUNTS /
     uses-permission
         android:name=android.permission.USE_CREDENTIALS /
     uses-permission
         android:name=android.permission.MANAGE_ACCOUNTS /
     uses-permission
         android:name=android.permission.AUTHENTICATE_ACCOUNTS /
     uses-permission
         android:name

[android-developers] Re: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-01-31 Thread himanshu jain
@Dmitri

Thanks a lot for spending time to answer my questions at least some
doubts are faded off.

1) I understand to use own activity for editing and creating new
contacts.

2) Ok, if i avoid ContentObserver even i had that in mind might
require something to be running in background which is bad agreed.

3) But, there are two use cases first if there is a button that say
sync now and i send request using requestSync() method will it start
immediate sync via SyncManager or again it will depend upon
SyncManager discretion?? if thats true i cannot start immediate
Sync ??.

  Second use case how would i know if there is a change corresponding
to my account in raw_contact utilizing best practice push
notification ?? so that i can trigger syncing.

thanks Dimitri for your time and ideas


On Jan 30, 11:42 am, Dmitri Plotnikov dplotni...@google.com wrote:
 Hi Himanshu,

 1) SampleSyncAdapter is still a good source of inspiration.  It has some
 issues and plan to have them fixed in the nearest future.

 2) In releases of Android from Eclair through Gingerbread integrated editing
 of 3rd party contacts is poorly supported.  The trick is to insert a data
 row, Edit in MyApp, which would take the user to your app and your app
 would then provide an editor activity.  Also, there is no provision in the
 Contacts UI for creating new contacts in 3rd party accounts.  We have fixed
 those issues in Honeycomb.  Now you can specify two activities in your
 metadata xml file: one for creating new contacts and one for editing
 existing ones and voilà! - you have seamless integration.  Of course, it's a
 bit too soon to rely on Honeycomb as the dominant version of Android ;-)  So
 for now you will need to either go with the described hack or only allow
 creation/editing of contacts through your app.

 3) Please consider an alternative to using content observers for a sync
 adapter.  There are several reasons:

 - In order to receive notifications, your process will need to be running at
 all times. Or it would have to have a broadcast receiver, which is very very
 costly.
 - Content observer notifications are not reliable.  If your process is not
 running at the time the change occurs, the notification will never be
 delivered.  A broadcast receiver will solve that problem, but please don't
 use broadcast receivers for this!
 - Contacts provider sends out non-discriminated notifications.  Whenever
 anything (e.g. chat presence) changes, all observers are notified whether
 they have supplied a specific URI or not.

 What you do want to use is the DIRTY flag and the CALLER_IS_SYNCADAPTER
 query parameter and let SyncManager invoke your sync adapter.  It does some
 sophisticated scheduling and you want to take advantage of it.

 Cheers,
 - Dmitri

 On Fri, Jan 28, 2011 at 4:22 PM, himanshu jain himanshu@gmail.comwrote:







  Hi All,

  I am trying to implement two way sync.

  1) I tried using SampleSyncAdapter Code first it works on emulator but
  not on Device , then i tried to write SyncAdapter with SyncService as
  a demo app with AccountAuthenticator, as per Documentation for
  SampleSyncAdapter SyncService gets called on
  ACTION_AUTHENTICATOR_INTENT but my service does not gets started on
  device , i defined service in manifest and all things but does not
  work on device it gets started on Emulator.

  2) If i port my app on device i can see only first name and last name
  fields how can i see all the fields available for contact
  application ?? can i edit them also utilizing the same native
  editor??.

  3) I planning to add contentobserver for sync from device to cloud
  whenever there is change corresponding to my account in contact table
  i want to sync it after listening through contentobserver.Is that
  correct ??.

  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.comandroid-developers%2Bunsubs 
  cr...@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] Re: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-01-31 Thread himanshu jain
@Dmitri

thanks once again

But why my SyncService not gets started by SyncManager on Device i
dont know , and i explicitly call requestSync flow is not going inside
onPerformSync.?


thanks

On Jan 31, 1:49 pm, Dmitri Plotnikov dplotni...@google.com wrote:
 Sending requestSync to contentresolver is the right way to go if you want an
 explicit button to request sync. This is what applications like Calendar and
 Gmail do when you push the Sync button.  ContentProvider will also request
 sync whenever there is a change in the data.

 You should query raw contacts that have the DIRTY flag set.  These are the
 added, deleted or changed contacts.   Your sync adapter should reset this
 flag after syncing up changes.  It also needs to physically remove deleted
 contacts from the database.  In both cases it needs to supply the
 CALLER_IS_SYNCADAPTER query parameter - otherwise the protocol won't work.

 Cheers,
 - Dmitri

 On Mon, Jan 31, 2011 at 1:37 PM, himanshu jain himanshu@gmail.comwrote:







  @Dmitri

  Thanks a lot for spending time to answer my questions at least some
  doubts are faded off.

  1) I understand to use own activity for editing and creating new
  contacts.

  2) Ok, if i avoid ContentObserver even i had that in mind might
  require something to be running in background which is bad agreed.

  3) But, there are two use cases first if there is a button that say
  sync now and i send request using requestSync() method will it start
  immediate sync via SyncManager or again it will depend upon
  SyncManager discretion?? if thats true i cannot start immediate
  Sync ??.

   Second use case how would i know if there is a change corresponding
  to my account in raw_contact utilizing best practice push
  notification ?? so that i can trigger syncing.

  thanks Dimitri for your time and ideas

  On Jan 30, 11:42 am, Dmitri Plotnikov dplotni...@google.com wrote:
   Hi Himanshu,

   1) SampleSyncAdapter is still a good source of inspiration.  It has some
   issues and plan to have them fixed in the nearest future.

   2) In releases of Android from Eclair through Gingerbread integrated
  editing
   of 3rd party contacts is poorly supported.  The trick is to insert a data
   row, Edit in MyApp, which would take the user to your app and your app
   would then provide an editor activity.  Also, there is no provision in
  the
   Contacts UI for creating new contacts in 3rd party accounts.  We have
  fixed
   those issues in Honeycomb.  Now you can specify two activities in your
   metadata xml file: one for creating new contacts and one for editing
   existing ones and voilà! - you have seamless integration.  Of course,
  it's a
   bit too soon to rely on Honeycomb as the dominant version of Android ;-)
   So
   for now you will need to either go with the described hack or only allow
   creation/editing of contacts through your app.

   3) Please consider an alternative to using content observers for a sync
   adapter.  There are several reasons:

   - In order to receive notifications, your process will need to be running
  at
   all times. Or it would have to have a broadcast receiver, which is very
  very
   costly.
   - Content observer notifications are not reliable.  If your process is
  not
   running at the time the change occurs, the notification will never be
   delivered.  A broadcast receiver will solve that problem, but please
  don't
   use broadcast receivers for this!
   - Contacts provider sends out non-discriminated notifications.  Whenever
   anything (e.g. chat presence) changes, all observers are notified whether
   they have supplied a specific URI or not.

   What you do want to use is the DIRTY flag and the CALLER_IS_SYNCADAPTER
   query parameter and let SyncManager invoke your sync adapter.  It does
  some
   sophisticated scheduling and you want to take advantage of it.

   Cheers,
   - Dmitri

   On Fri, Jan 28, 2011 at 4:22 PM, himanshu jain himanshu@gmail.com
  wrote:

Hi All,

I am trying to implement two way sync.

1) I tried using SampleSyncAdapter Code first it works on emulator but
not on Device , then i tried to write SyncAdapter with SyncService as
a demo app with AccountAuthenticator, as per Documentation for
SampleSyncAdapter SyncService gets called on
ACTION_AUTHENTICATOR_INTENT but my service does not gets started on
device , i defined service in manifest and all things but does not
work on device it gets started on Emulator.

2) If i port my app on device i can see only first name and last name
fields how can i see all the fields available for contact
application ?? can i edit them also utilizing the same native
editor??.

3) I planning to add contentobserver for sync from device to cloud
whenever there is change corresponding to my account in contact table
i want to sync it after listening through contentobserver.Is that
correct ??.

thanks

--
You received this message

[android-developers] Re: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-01-31 Thread himanshu jain
@Dmitri

Yes i created my account when i go to Account  sync section through
settings and after adding my account , sync gets enabled in DDMS i can
see SyncManager gets called twice once on setIsSyncable and on
setSyncAutomatically but My Service associated with SyncAdapter does
not gets started and also i dont reach to onPerformSync immediately
when i explicitly call requestSync.

thanks

On Jan 31, 4:11 pm, Dmitri Plotnikov dplotni...@google.com wrote:
 Do you see your account in Settings/Accounts?   Does it have contact syncing
 enabled?

 On Mon, Jan 31, 2011 at 2:44 PM, himanshu jain himanshu@gmail.comwrote:







  @Dmitri

  thanks once again

  But why my SyncService not gets started by SyncManager on Device i
  dont know , and i explicitly call requestSync flow is not going inside
  onPerformSync.?

  thanks

  On Jan 31, 1:49 pm, Dmitri Plotnikov dplotni...@google.com wrote:
   Sending requestSync to contentresolver is the right way to go if you want
  an
   explicit button to request sync. This is what applications like Calendar
  and
   Gmail do when you push the Sync button.  ContentProvider will also
  request
   sync whenever there is a change in the data.

   You should query raw contacts that have the DIRTY flag set.  These are
  the
   added, deleted or changed contacts.   Your sync adapter should reset this
   flag after syncing up changes.  It also needs to physically remove
  deleted
   contacts from the database.  In both cases it needs to supply the
   CALLER_IS_SYNCADAPTER query parameter - otherwise the protocol won't
  work.

   Cheers,
   - Dmitri

   On Mon, Jan 31, 2011 at 1:37 PM, himanshu jain himanshu@gmail.com
  wrote:

@Dmitri

Thanks a lot for spending time to answer my questions at least some
doubts are faded off.

1) I understand to use own activity for editing and creating new
contacts.

2) Ok, if i avoid ContentObserver even i had that in mind might
require something to be running in background which is bad agreed.

3) But, there are two use cases first if there is a button that say
sync now and i send request using requestSync() method will it start
immediate sync via SyncManager or again it will depend upon
SyncManager discretion?? if thats true i cannot start immediate
Sync ??.

 Second use case how would i know if there is a change corresponding
to my account in raw_contact utilizing best practice push
notification ?? so that i can trigger syncing.

thanks Dimitri for your time and ideas

On Jan 30, 11:42 am, Dmitri Plotnikov dplotni...@google.com wrote:
 Hi Himanshu,

 1) SampleSyncAdapter is still a good source of inspiration.  It has
  some
 issues and plan to have them fixed in the nearest future.

 2) In releases of Android from Eclair through Gingerbread integrated
editing
 of 3rd party contacts is poorly supported.  The trick is to insert a
  data
 row, Edit in MyApp, which would take the user to your app and your
  app
 would then provide an editor activity.  Also, there is no provision
  in
the
 Contacts UI for creating new contacts in 3rd party accounts.  We have
fixed
 those issues in Honeycomb.  Now you can specify two activities in
  your
 metadata xml file: one for creating new contacts and one for editing
 existing ones and voilà! - you have seamless integration.  Of course,
it's a
 bit too soon to rely on Honeycomb as the dominant version of Android
  ;-)
 So
 for now you will need to either go with the described hack or only
  allow
 creation/editing of contacts through your app.

 3) Please consider an alternative to using content observers for a
  sync
 adapter.  There are several reasons:

 - In order to receive notifications, your process will need to be
  running
at
 all times. Or it would have to have a broadcast receiver, which is
  very
very
 costly.
 - Content observer notifications are not reliable.  If your process
  is
not
 running at the time the change occurs, the notification will never be
 delivered.  A broadcast receiver will solve that problem, but please
don't
 use broadcast receivers for this!
 - Contacts provider sends out non-discriminated notifications.
   Whenever
 anything (e.g. chat presence) changes, all observers are notified
  whether
 they have supplied a specific URI or not.

 What you do want to use is the DIRTY flag and the
  CALLER_IS_SYNCADAPTER
 query parameter and let SyncManager invoke your sync adapter.  It
  does
some
 sophisticated scheduling and you want to take advantage of it.

 Cheers,
 - Dmitri

 On Fri, Jan 28, 2011 at 4:22 PM, himanshu jain 
  himanshu@gmail.com
wrote:

  Hi All,

  I am trying to implement two way sync.

  1) I tried using SampleSyncAdapter Code first it works on emulator
  but
  not on Device , then i tried to write

[android-developers] Re: Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-01-31 Thread himanshu jain
this is my manifest file

manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=org.c99.SyncProviderDemo
  android:versionCode=1
  android:versionName=1.0

uses-permission
android:name=android.permission.GET_ACCOUNTS /
uses-permission
android:name=android.permission.USE_CREDENTIALS /
uses-permission
android:name=android.permission.MANAGE_ACCOUNTS /
uses-permission
android:name=android.permission.AUTHENTICATE_ACCOUNTS /
uses-permission
android:name=android.permission.INTERNET /
uses-permission
android:name=android.permission.WRITE_SETTINGS /
uses-permission
android:name=android.permission.WRITE_SECURE_SETTINGS /
uses-permission
android:name=android.permission.READ_CONTACTS /
uses-permission
android:name=android.permission.WRITE_CONTACTS /
uses-permission
android:name=android.permission.READ_SYNC_STATS /
uses-permission
android:name=android.permission.READ_SYNC_SETTINGS /
uses-permission
android:name=android.permission.WRITE_SYNC_SETTINGS /

application android:icon=@drawable/icon android:label=@string/
app_name
activity android:name=.LoginActivity
  android:label=@string/app_name
intent-filter
action android:name=android.intent.action.VIEW /
/intent-filter
/activity
activity android:name=.ProfileActivity
android:label=Profile
intent-filter
action 
android:name=android.intent.action.VIEW /
category 
android:name=android.intent.category.DEFAULT /
data android:mimeType=vnd.android.cursor.item/
vnd.org.c99.SyncProviderDemo.profile /
/intent-filter
/activity
service android:name=.AccountAuthenticatorService
android:exported=true
intent-filter
action 
android:name=android.accounts.AccountAuthenticator /
/intent-filter
meta-data 
android:name=android.accounts.AccountAuthenticator
android:resource=@xml/authenticator /
/service
service android:name=.ContactsSyncAdapterService
android:exported=true 
intent-filter
action 
android:name=android.content.SyncAdapter /
/intent-filter
meta-data android:name=android.content.SyncAdapter
android:resource=@xml/syncadapter /
meta-data 
android:name=android.provider.CONTACTS_STRUCTURE
android:resource=@xml/contacts /
/service

/application
uses-sdk android:minSdkVersion=5 /

/manifest

thanks

On Jan 31, 4:53 pm, Dmitri Plotnikov dplotni...@google.com wrote:
 I would double-check every line of AndroidManifest.xml, compare it with the
 one in SampleSyncAdapter to see if anything's missing.

 On Mon, Jan 31, 2011 at 4:26 PM, himanshu jain himanshu@gmail.comwrote:







  @Dmitri

  Yes i created my account when i go to Account  sync section through
  settings and after adding my account , sync gets enabled in DDMS i can
  see SyncManager gets called twice once on setIsSyncable and on
  setSyncAutomatically but My Service associated with SyncAdapter does
  not gets started and also i dont reach to onPerformSync immediately
  when i explicitly call requestSync.

  thanks

  On Jan 31, 4:11 pm, Dmitri Plotnikov dplotni...@google.com wrote:
   Do you see your account in Settings/Accounts?   Does it have contact
  syncing
   enabled?

   On Mon, Jan 31, 2011 at 2:44 PM, himanshu jain himanshu@gmail.com
  wrote:

@Dmitri

thanks once again

But why my SyncService not gets started by SyncManager on Device i
dont know , and i explicitly call requestSync flow is not going inside
onPerformSync.?

thanks

On Jan 31, 1:49 pm, Dmitri Plotnikov dplotni...@google.com wrote:
 Sending requestSync to contentresolver is the right way to go if you
  want
an
 explicit button to request sync. This is what applications like
  Calendar
and
 Gmail do when you push the Sync button.  ContentProvider will also
request
 sync whenever there is a change in the data.

 You should query raw contacts that have the DIRTY flag set.  These
  are
the
 added, deleted or changed contacts.   Your sync adapter should reset
  this
 flag after syncing up changes.  It also needs to physically remove
deleted
 contacts from the database.  In both cases it needs to supply the
 CALLER_IS_SYNCADAPTER query parameter - otherwise the protocol

[android-developers] Questions about Two Way Sync Using SyncAdapter and SyncService in android

2011-01-28 Thread himanshu jain
Hi All,

I am trying to implement two way sync.

1) I tried using SampleSyncAdapter Code first it works on emulator but
not on Device , then i tried to write SyncAdapter with SyncService as
a demo app with AccountAuthenticator, as per Documentation for
SampleSyncAdapter SyncService gets called on
ACTION_AUTHENTICATOR_INTENT but my service does not gets started on
device , i defined service in manifest and all things but does not
work on device it gets started on Emulator.

2) If i port my app on device i can see only first name and last name
fields how can i see all the fields available for contact
application ?? can i edit them also utilizing the same native
editor??.

3) I planning to add contentobserver for sync from device to cloud
whenever there is change corresponding to my account in contact table
i want to sync it after listening through contentobserver.Is that
correct ??.

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: Grab phonebook-contacts via ContactsContract-API

2011-01-21 Thread himanshu jain
Hi Dmitri  ,@LordAli3n
I have couple of questions please spare some time or guide me
direction
1) Can we use syncAdapter to get data of a row of raw_contact table if
that row has been affected (i.e added/deleted/edited). I know
ContentObserver notify whenever raw_content table changes in
onChange() method but we dont know which row has been changed ( to put
this in another way if we add how would we know and if deleted we
still get it through deleted flag in raw_contact table but how about
edited one??).
2) when we get notification in ContentObserver can we fire requestSync
(Account account, String authority, Bundle extras) to start Sync ??
how we can get data of raw_contact affected by contact application
using these to parameters .
3) Is sync started by ContentProvider API ?? whenever change to it
happens ??. How?? does it pass any useful uri or data that has been
changed in raw_contacts??.
4) How do we come to know if in the process of  syncing something went
wrong?? does it started again automatically??.

thanks any help appreciated !!

On Jan 19, 7:31 am, BoD bodl...@gmail.com wrote:
 If I may intervene.
 It seems to me that the OP wants to synchronize contacts using the
 sync adapters APIs, and therefore wants to have his own account type,
 and raw contacts in this account.

 But that means that when the user first starts using this app, this
 account will be empty, and will synchronize... nothing.
 Instead, they probably expect to synchronize the contacts already on
 their phones (in the local account, or, more probably, in the gmail
 account).

 --
 BoD

 On Jan 19, 9:02 am, Dmitri Plotnikov dplotni...@google.com wrote:







  I am sorry. I guess I just don't understand the requirements.  I thought you
  were writing a sync adapter.  Sync adapters all deal with their own
  accounts.  Google sync adapter deals with google accounts, exchange adapter
  with exchange accounts and so on.  If you are thinking of writing a sync
  adapter that would handle data already handled by some other sync adapter,
  it is probably a bad idea. The framework is not designed to have multiple
  sync adapters handling the same data: only one syncadapter can take
  advantage of data versioning. This why I suggested that if you are writing a
  sync adapter, you should introduce a new account type. This is how they are
  supposed to work by design.

  Cheers,
  Dmitri
  On Jan 18, 2011 5:43 PM, L0rdAli3n 42.john.doe.1...@googlemail.com
  wrote:

   Thanks for your answer Dmitri!

   Could you explain in few words, how I can use the contacts the user
   stored on his phone,
   which in fact all have already an account_type, by introducing my own
   accout_type?

   On 14 Jan., 16:26, Dmitri Plotnikov dplotni...@google.com wrote:
   I don't fully understand your requirements, but it shouldn't matter what
   _other_ data is in the contacts DB.  A sync adapter should only deal with
   its own data. Why not introduce a new account type for this purpose?

   Cheers,
   Dmitri
   On Jan 14, 2011 5:16 AM, L0rdAli3n 42.john.doe.1...@googlemail.com
   wrote:

Hey,

I'm totally stuck with the ContactsContract-API. Point is that I want
only mess around with the Contacts saved in the local phonebook. But
it seems that every vendor but its own account_type for those
contacts.
And its even worse. The AccountManager isn't even aware of all
account_types?!?
For example on my HTC Desire with HTC Sense, the account_type all
local contacts are saved in is: com.htc.android.pcsc. But when I grab
a list of all available accounts from the AccountManager: This account
is not in the list!?
I also tested it on a Samsung Galaxy. Same here: The AccountManager is
not aware of the account_type used for local phonebookcontacts.

The whole story is that I wan't to write a app to sync my locale
phonebook with OpenXchange.

I guess I got that whole new ContactsContract-API wrong, but I don't
see any other way, then using RawContacts. Due to that I have to care
about the account_type, which is in fact a total mess.

Hopefully someone can point me in the right direction. Every hint is
highly appreciated.

--
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%2Bunsubs
 cr...@googlegroups.com

  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252Bu 
  nsubscr...@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, 

[android-developers] How Sync Adapter works

2011-01-19 Thread himanshu jain
Can Anyone gives a little bit more explanation like who initiate the
the sync adapter if it is sync manager how it does that and what make
it to do that. Is the sync adapter run periodically or when it gets
notification that raw-contacts has been changed ?, can we customize
the sync adapter execution ??. If you have any idea please shed light
on those question.


I am trying to listen to raw_contacts database table through
ContentObserver but i can only get the notification when database
changes , what i really want which particular row of the table has
changed , i know on change we can query about add ( i.e to query
highest contact id entered into the database) and for delete check the
delete flag set in the raw_contacts but how to know about which id had
been updated ?.

I was thinking alternative to ContentObserver the syncAdapter but i
dont get it how and when sync manager start the syncadapter ? can we
control it?.

any info appreciated!!

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] Android Sync Adapter and ContentObserver , how to get contact info from content provider when raw_contacts db changes

2011-01-19 Thread himanshu jain
Can Anyone gives a little bit more explanation like who initiate the
the sync adapter if it is sync manager how it does that and what make
it to do that. Is the sync adapter run periodically or when it gets
notification that raw-contacts has been changed ?, can we customize
the sync adapter execution ??. If you have any idea please shed light
on those question.


I am trying to listen to raw_contacts database table through
ContentObserver but i can only get the notification when database
changes , what i really want which particular row of the table has
changed , i know on change we can query about add ( i.e to query
highest contact id entered into the database) and for delete check the
delete flag set in the raw_contacts but how to know about which id had
been updated ?.

I was thinking alternative to ContentObserver the syncAdapter but i
dont get it how and when sync manager start the syncadapter ? can we
control it?.

any info appreciated!!

-- 
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: Question For All Android Developer

2010-10-12 Thread himanshu jain
@kumar bibek

What i am trying to do is simple i want to embed using any video or
other tag mp4 file in android webview and want to paly it similarly to
facebook does allow with flash player to play video , i want similar
thing .
 i tried it but once i pass the intent android player show up on full
screen

-- 
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] Question For All Android Developer

2010-10-11 Thread himanshu jain
Hi All,

My Question is can we embed mp4 file in android webview client.?


Second, is can we embed apk file in WebViewClient?.



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 Set Abstract Class Object as an instance of Another class From Native Code using JNI in Android

2010-07-08 Thread himanshu jain
Hi All,
   I have Class in having  an abstract class object as a field
in JAVA layer . I want to set this field From Native code  C++.I am
Trying to use SetObjectField() to set , but it does not work out .Does
anyone try this before or know who to do it please shed some light on
it


thanks
Himanshu

-- 
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 Set Abstract Class Object as an instance of Another class From Native Code using JNI in Android

2010-07-08 Thread himanshu jain
Hi All,
   I have Class in having  an abstract class object as a field
in JAVA layer . I want to set this field From Native code  C++.I am
Trying to use SetObjectField() to set , but it does not work out .Does
anyone try this before or know who to do it please shed some light on
it.


thanks
Himanshu

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-12 Thread himanshu jain
@Mark Murphy

If you Read my Questions and issues Please spend little time to answer
it .I am kind of stuck ,i want to implement service indefinitely in
the background or i want   network  to be available all the time to
implement my service.How can i do it ?? .

Please reply



On Feb 11, 12:28 am, himanshu jain himanshu@gmail.com wrote:
 @andrew

 Tell me one thing some people have wifi ON whereas most of them depend
 upon 2g
 and 3g because of battery issue. So if wifi is not there i should
 still expect this kind of error or issue???.
 I mean i can not consistently poll to any website for news , if yes
 how, even when most does not have wifi ? is there any generic solution
 to my problem.?

 On Feb 11, 12:22 am,himanshujain himanshu@gmail.com wrote:

  @andrew

  Tell me one thing some people has wifi on most of them depend upon 2g
  and 3g because of battery issue. So if wifi is not there i should
  still expect this kind of error or issue???.
  I mean i can not consistently poll to any website for news , if yes
  how even when most does not have wifi ? is there any generic solution
  to my problem.?

  On Feb 10, 5:53 pm, andrew_prunicki andrew.pruni...@gmail.com wrote:

   Sorry for the slow response.  I did not see your question until just
   now.

   I faced the same issue.  I had it connecting repeatedly over wifi
   only.  What I learned was that the wifi radio was turned off when the
   screensaver came on.  I went thru several attempts to get it to work.
   I ended up getting a wake lock on the PowerManager, but this was very
   expensive in terms of power usage.  I also locked the wifi with the
   WifiManager.

   This was back in Android 1.0/1.1, and I believe is completely
   unnecessary now.  I noticed that Android 1.6 has the ability to keep
   the wifi connection in the settings.  I imagine you can
   programmatically do this as well - hopefully without acquiring a
   wakelock.

   On Feb 7, 10:49 pm,himanshujainhimanshu@gmail.com wrote:

@prunicki

You application was connecting with internet repeatedly?? if yes did
you face this same issue and how did you work out that ?

On Feb 7, 8:43 pm,himanshujainhimanshu@gmail.com wrote:

 @frank

 I already tried in differentnetworkat home and at office , I have
 been trying this on G1 at home i try on WIFI and at office at tried
 when WIFI is OFF and i am using ip address not host name.

 I am using Alarm manager which call service repeatedly after 5 minutes
 so once it throws Exception(NetworkUnreachable). Alarm manager does
 not stop by this exception it again start service on specified time
 and then my service try to connect through HttpURLConnection it says
NetworkUnreachable.

 On Feb 7, 7:16 pm, prunicki andrew.pruni...@gmail.com wrote:

  I tried something similar back in Android 1.0/1.1 using only wifi.
  What I found is that once the wifi connection was lost, the only way
  to get it back was to fully wakeup the phone.

  I think it may be different with the later versions of the SDK, but 
  in
  case it's not...

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-11 Thread himanshu jain
@andrew

Tell me one thing some people has wifi on most of them depend upon 2g
and 3g because of battery issue. So if wifi is not there i should
still expect this kind of error or issue???.
I mean i can not consistently poll to any website for news , if yes
how even when most does not have wifi ? is there any generic solution
to my problem.?



On Feb 10, 5:53 pm, andrew_prunicki andrew.pruni...@gmail.com wrote:
 Sorry for the slow response.  I did not see your question until just
 now.

 I faced the same issue.  I had it connecting repeatedly over wifi
 only.  What I learned was that the wifi radio was turned off when the
 screensaver came on.  I went thru several attempts to get it to work.
 I ended up getting a wake lock on the PowerManager, but this was very
 expensive in terms of power usage.  I also locked the wifi with the
 WifiManager.

 This was back in Android 1.0/1.1, and I believe is completely
 unnecessary now.  I noticed that Android 1.6 has the ability to keep
 the wifi connection in the settings.  I imagine you can
 programmatically do this as well - hopefully without acquiring a
 wakelock.

 On Feb 7, 10:49 pm,himanshujainhimanshu@gmail.com wrote:

  @prunicki

  You application was connecting with internet repeatedly?? if yes did
  you face this same issue and how did you work out that ?

  On Feb 7, 8:43 pm,himanshujainhimanshu@gmail.com wrote:

   @frank

   I already tried in differentnetworkat home and at office , I have
   been trying this on G1 at home i try on WIFI and at office at tried
   when WIFI is OFF and i am using ip address not host name.

   I am using Alarm manager which call service repeatedly after 5 minutes
   so once it throws Exception(NetworkUnreachable). Alarm manager does
   not stop by this exception it again start service on specified time
   and then my service try to connect through HttpURLConnection it says
  NetworkUnreachable.

   On Feb 7, 7:16 pm, prunicki andrew.pruni...@gmail.com wrote:

I tried something similar back in Android 1.0/1.1 using only wifi.
What I found is that once the wifi connection was lost, the only way
to get it back was to fully wakeup the phone.

I think it may be different with the later versions of the SDK, but in
case it's not...

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-11 Thread himanshu jain
@andrew

Tell me one thing some people have wifi on most of them depend upon 2g
and 3g because of battery issue. So if wifi is not there i should
still expect this kind of error or issue???.
I mean i can not consistently poll to any website for news , if yes
how even when most does not have wifi ? is there any generic solution
to my problem.?

On Feb 10, 5:53 pm, andrew_prunicki andrew.pruni...@gmail.com wrote:
 Sorry for the slow response.  I did not see your question until just
 now.

 I faced the same issue.  I had it connecting repeatedly over wifi
 only.  What I learned was that the wifi radio was turned off when the
 screensaver came on.  I went thru several attempts to get it to work.
 I ended up getting a wake lock on the PowerManager, but this was very
 expensive in terms of power usage.  I also locked the wifi with the
 WifiManager.

 This was back in Android 1.0/1.1, and I believe is completely
 unnecessary now.  I noticed that Android 1.6 has the ability to keep
 the wifi connection in the settings.  I imagine you can
 programmatically do this as well - hopefully without acquiring a
 wakelock.

 On Feb 7, 10:49 pm,himanshujainhimanshu@gmail.com wrote:

  @prunicki

  You application was connecting with internet repeatedly?? if yes did
  you face this same issue and how did you work out that ?

  On Feb 7, 8:43 pm,himanshujainhimanshu@gmail.com wrote:

   @frank

   I already tried in differentnetworkat home and at office , I have
   been trying this on G1 at home i try on WIFI and at office at tried
   when WIFI is OFF and i am using ip address not host name.

   I am using Alarm manager which call service repeatedly after 5 minutes
   so once it throws Exception(NetworkUnreachable). Alarm manager does
   not stop by this exception it again start service on specified time
   and then my service try to connect through HttpURLConnection it says
  NetworkUnreachable.

   On Feb 7, 7:16 pm, prunicki andrew.pruni...@gmail.com wrote:

I tried something similar back in Android 1.0/1.1 using only wifi.
What I found is that once the wifi connection was lost, the only way
to get it back was to fully wakeup the phone.

I think it may be different with the later versions of the SDK, but in
case it's not...

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-11 Thread himanshu jain
@andrew

Tell me one thing some people have wifi ON whereas most of them depend
upon 2g
and 3g because of battery issue. So if wifi is not there i should
still expect this kind of error or issue???.
I mean i can not consistently poll to any website for news , if yes
how, even when most does not have wifi ? is there any generic solution
to my problem.?

On Feb 11, 12:22 am, himanshu jain himanshu@gmail.com wrote:
 @andrew

 Tell me one thing some people has wifi on most of them depend upon 2g
 and 3g because of battery issue. So if wifi is not there i should
 still expect this kind of error or issue???.
 I mean i can not consistently poll to any website for news , if yes
 how even when most does not have wifi ? is there any generic solution
 to my problem.?

 On Feb 10, 5:53 pm, andrew_prunicki andrew.pruni...@gmail.com wrote:

  Sorry for the slow response.  I did not see your question until just
  now.

  I faced the same issue.  I had it connecting repeatedly over wifi
  only.  What I learned was that the wifi radio was turned off when the
  screensaver came on.  I went thru several attempts to get it to work.
  I ended up getting a wake lock on the PowerManager, but this was very
  expensive in terms of power usage.  I also locked the wifi with the
  WifiManager.

  This was back in Android 1.0/1.1, and I believe is completely
  unnecessary now.  I noticed that Android 1.6 has the ability to keep
  the wifi connection in the settings.  I imagine you can
  programmatically do this as well - hopefully without acquiring a
  wakelock.

  On Feb 7, 10:49 pm,himanshujainhimanshu@gmail.com wrote:

   @prunicki

   You application was connecting with internet repeatedly?? if yes did
   you face this same issue and how did you work out that ?

   On Feb 7, 8:43 pm,himanshujainhimanshu@gmail.com wrote:

@frank

I already tried in differentnetworkat home and at office , I have
been trying this on G1 at home i try on WIFI and at office at tried
when WIFI is OFF and i am using ip address not host name.

I am using Alarm manager which call service repeatedly after 5 minutes
so once it throws Exception(NetworkUnreachable). Alarm manager does
not stop by this exception it again start service on specified time
and then my service try to connect through HttpURLConnection it says
   NetworkUnreachable.

On Feb 7, 7:16 pm, prunicki andrew.pruni...@gmail.com wrote:

 I tried something similar back in Android 1.0/1.1 using only wifi.
 What I found is that once the wifi connection was lost, the only way
 to get it back was to fully wakeup the phone.

 I think it may be different with the later versions of the SDK, but in
 case it's not...

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-07 Thread himanshu jain
Thanks Anthoni and Frank

@Anthoni and @Frank

I checked this code , actually i had already implemented in this way
instead of on  BOOT i used Alarm Manager that repeatedly wake up the
phone after 5 minutes and then i start my service.

But the problem is background service works fine for 15 minutes or
more and after sometimes it throws Socket.net Exception Network
Unreachable??. This is when i am trying to connect with my company
server for updates .

On Feb 7, 1:36 am, Anthoni anthoni.gard...@gmail.com wrote:
 Hihimanshu,

 The code, along with all other test / demo applications done by the
 android team, is located on Google under subversion.

 This link ishttp://code.google.com/p/apps-for-android/

 Regards
 Anthoni

 On Feb 7, 5:37 am,himanshujain himanshu@gmail.com wrote:

  @frank

  Can you please tell me where i can find that sample code.

  thanks

  On Feb 6, 9:28 pm,himanshujain himanshu@gmail.com wrote:

   @frank

   Thank you very much let me look at those sample then i  will let you
   know.

   once again thanx

   On Feb 6, 7:14 pm, Frank Weiss fewe...@gmail.com wrote:

Re your question about implementing a service that polls for updates, 
please
look at some of the sample code. For example, Romain Guy's Photostream 
demo
application has a background service that polls the Flikr API 
webservice for
updates and displays a notification in the notification bar. AFAIK 
whether
the access is by phone network or WiFi is functionally irrelevant.

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-07 Thread himanshu jain
@frank

Service does not crash completely , it consistently throwing
Socket.net Exception Netwrok unreachable after five minutes.
If phone is not always connected to network then what is the way of
implementing , i dont get this point . Yeah i am assuming phone is
connected with network and i should possibly connect to server on
stipulated time.

thanks

On Feb 7, 5:06 pm, Frank Weiss fewe...@gmail.com wrote:
 Is the service completely crashing due to the exception or does the service
 continue to get the exception subsequently? Are you perhaps wrongly assuming
 that the phone is connected to the internet whenever you want it to be?

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-07 Thread himanshu jain
@frank

I already tried in different network at home and at office , I have
been trying this on G1 at home i try on WIFI and at office at tried
when WIFI is OFF and i am using ip address not host name.

I am using Alarm manager which call service repeatedly after 5 minutes
so once it throws Exception(Network Unreachable). Alarm manager does
not stop by this exception it again start service on specified time
and then my service try to connect through HttpURLConnection it says
Network Unreachable.

On Feb 7, 7:16 pm, prunicki andrew.pruni...@gmail.com wrote:
 I tried something similar back in Android 1.0/1.1 using only wifi.
 What I found is that once the wifi connection was lost, the only way
 to get it back was to fully wakeup the phone.

 I think it may be different with the later versions of the SDK, but in
 case it's not...

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-07 Thread himanshu jain
@prunicki

You application was connecting with internet repeatedly?? if yes did
you face this same issue and how did you work out that ?

On Feb 7, 8:43 pm, himanshu jain himanshu@gmail.com wrote:
 @frank

 I already tried in different network at home and at office , I have
 been trying this on G1 at home i try on WIFI and at office at tried
 when WIFI is OFF and i am using ip address not host name.

 I am using Alarm manager which call service repeatedly after 5 minutes
 so once it throws Exception(Network Unreachable). Alarm manager does
 not stop by this exception it again start service on specified time
 and then my service try to connect through HttpURLConnection it says
 Network Unreachable.

 On Feb 7, 7:16 pm, prunicki andrew.pruni...@gmail.com wrote:

  I tried something similar back in Android 1.0/1.1 using only wifi.
  What I found is that once the wifi connection was lost, the only way
  to get it back was to fully wakeup the phone.

  I think it may be different with the later versions of the SDK, but in
  case it's not...

-- 
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] Network Unreachable (Socket.net Exception)

2010-02-06 Thread himanshu jain
Hi ,
   I am trying to connect to server through
HttpUrlConnection, but after sometimes it throws Socket.Net
Exception :Network Unreachable. I tired alarm manager to wake up the
phone and get the wifi lock but none seems to work .

Tell me what to do what should i check and alternative ?.


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] Network Unreachable (Socket.net Exception)

2010-02-06 Thread himanshu jain
Hi ,
   I am trying to connect to server through
HttpUrlConnection, but after sometimes it throws Socket.Net
Exception :Network Unreachable. I tired alarm manager to wake up the
phone and get the wifi lock but none seems to work .

Tell me what to do what should i check and alternative ?.


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: Network Unreachable (Socket.net Exception)

2010-02-06 Thread himanshu jain
@bob

I think i used connect to another website that sends news in order to
check whether it is wrong at network side or in my code.
Also my question is , can we really implement a service that runs in
background indefinitely and give us update if it is available .If yes,
then what parameters we should be aware of in sense of  phone
network ??.

please advice.

thank you

On Feb 6, 10:59 am, Bob Kerns r...@acm.org wrote:
 This error indicates that some router along the path (possibly your
 local machine) has no route to the network you're trying to reach.

 If you're running on a rooted phone, you can run traceroute host to
 see the route to the host, if you have it; the busybox version works
 well. This will show where the problem lies.

 If the routing failure is on the local phone, 'route' will tell you
 about the local routing tables, if you're using the BusyBox version of
 'route'. You can also get it via 'cat /proc/net/route', but in a much
 harder-to-understand format. Don't bother trying to figure out how to
 use the built-in version; it's incomplete.

 If it's not on the phone, it's not a phone problem. In any event, it's
 definitely not an application problem, but a network failure (assuming
 you're not trying to connect to some crazy address). It's something
 you need to handle gracefully.

 If the problem is not on the phone, and you're using wifi, you should
 be able to observe the problem from any host on that network (at least
 if it's getting the same default gateway, which would normally be the
 case). So I'd try that first, rather than dealing with the limited
 environment on the phone.

 On Feb 6, 1:58 am,himanshujain himanshu@gmail.com wrote:

  Hi ,
                 I am trying to connect to server through
  HttpUrlConnection, but after sometimes it throws Socket.Net
  Exception :Network Unreachable. I tired alarm manager to wake up the
  phone and get the wifi lock but none seems to work .

  Tell me what to do what should i check and alternative ?.

  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 keep WiFi from going to sleep?

2010-02-06 Thread himanshu jain
You Can do it by acquiring wifilock but for this you need to wake up
the phone using Alarm manager.

I suggest you to see Alarm Manager and wifilick

On Feb 6, 5:01 pm, Moto medicalsou...@gmail.com wrote:
 I'm seeing that some users are downloading data via my application and
 their connection is dropped because the WiFi is going to sleep.

 Could I somehow take control over WiFi to keep it alive and once I'm
 done I return it to it's default state?

 Thanks,
 -Moto!

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-06 Thread himanshu jain
@frank

Thank you very much let me look at those sample then i  will let you
know.

once again thanx

On Feb 6, 7:14 pm, Frank Weiss fewe...@gmail.com wrote:
 Re your question about implementing a service that polls for updates, please
 look at some of the sample code. For example, Romain Guy's Photostream demo
 application has a background service that polls the Flikr API webservice for
 updates and displays a notification in the notification bar. AFAIK whether
 the access is by phone network or WiFi is functionally irrelevant.

-- 
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: Network Unreachable (Socket.net Exception)

2010-02-06 Thread himanshu jain
@frank

Can you please tell me where i can find that sample code.

thanks

On Feb 6, 9:28 pm, himanshu jain himanshu@gmail.com wrote:
 @frank

 Thank you very much let me look at those sample then i  will let you
 know.

 once again thanx

 On Feb 6, 7:14 pm, Frank Weiss fewe...@gmail.com wrote:

  Re your question about implementing a service that polls for updates, please
  look at some of the sample code. For example, Romain Guy's Photostream demo
  application has a background service that polls the Flikr API webservice for
  updates and displays a notification in the notification bar. AFAIK whether
  the access is by phone network or WiFi is functionally irrelevant.

-- 
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: Wakelock and phone restarts

2010-02-03 Thread himanshu jain
I had the same problem i used wake lock but still i think before i
acquire wakelock wifi goes in sleep mode .

On Feb 2, 11:45 am, nikhil nik...@gmail.com wrote:
 It seems there is a conflict between call forwarding and wakelock...

 Can someone test this out please? If you have a service which
 implements a wakelock (partial for my case), try enabling the call
 forward option in the settings when the service is running in the
 background...

 and please let me know here if the phone keeps restarting..

 Please help people...

 On Feb 2, 10:51 am, nikhil nik...@gmail.com wrote:

  It seems there is some conflict between my service and call
  forwarding. Whenever I have my service running in the background,
  after I enable call forwarding the phone restarts and the keeps
  restarting.

  Has anyone experienced this?

  On Feb 2, 10:26 am, nikhil nik...@gmail.com wrote:

   What can cause thephoneto restart ?

   On Jan 28, 11:18 am, nikhil nik...@gmail.com wrote:

Hello Friends,

I have a service which holds on to a wakelock and the code is similar
to this,

public class WakeLockService extends Service {

PowerManager.WakeLock wl;

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

        public void onCreate() {
                PowerManager pm = (PowerManager) getSystemService
(Context.POWER_SERVICE);
                wl = pm.newWakeLock (PowerManager.PARTIAL_WAKE_LOCK,
My Tag);

                wl.acquire();
        }

        public void onDestroy() {
                wl.release();
        }

For past two days, myphonehas been restarting randomly...Today it
was worse, it kept restarting untill I uninstalled the app.

I tried to search about this behaviour online and found that too many
wakelocks may coz thephonetorestart. Can there be any other reason?

Is the above code right? Should make wl as a final variable? Does the
service call onDestroy method whenphoneshuts down?

I am using a broadcastreceiver to start my service at boot up as well.

Any help would be appreciated.

Thank You So Much

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Wakelock and phone restarts

2010-02-03 Thread himanshu jain
In my case i have a service running in background which is started by
alarm manager after 5 minutes (i used it because i want CPU keep
running ), For sometimes it works fine becuase i am holding wake lock
but after half an hour it does not .


On Feb 3, 10:04 am, nikhil nik...@gmail.com wrote:
 I dont have any issues with wifi after holding on to wakelock...but
 yeah
 when I try to forward calls the phone starts rebooting itself ...I
 have to kill the service to stop it from rebooting again and again...
 I have no clue why that happens..

 On Feb 3, 11:04 am, himanshu jain himanshu@gmail.com wrote:

  I had the same problem i used wake lock but still i think before i
  acquire wakelock wifi goes in sleep mode .

  On Feb 2, 11:45 am, nikhil nik...@gmail.com wrote:

   It seems there is a conflict between call forwarding and wakelock...

   Can someone test this out please? If you have a service which
   implements a wakelock (partial for my case), try enabling the call
   forward option in the settings when the service is running in the
   background...

   and please let me know here if the phone keeps restarting..

   Please help people...

   On Feb 2, 10:51 am, nikhil nik...@gmail.com wrote:

It seems there is some conflict between my service and call
forwarding. Whenever I have my service running in the background,
after I enable call forwarding the phone restarts and the keeps
restarting.

Has anyone experienced this?

On Feb 2, 10:26 am, nikhil nik...@gmail.com wrote:

 What can cause thephoneto restart ?

 On Jan 28, 11:18 am, nikhil nik...@gmail.com wrote:

  Hello Friends,

  I have a service which holds on to a wakelock and the code is 
  similar
  to this,

  public class WakeLockService extends Service {

  PowerManager.WakeLock wl;

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

          public void onCreate() {
                  PowerManager pm = (PowerManager) getSystemService
  (Context.POWER_SERVICE);
                  wl = pm.newWakeLock (PowerManager.PARTIAL_WAKE_LOCK,
  My Tag);

                  wl.acquire();
          }

          public void onDestroy() {
                  wl.release();
          }

  For past two days, myphonehas been restarting randomly...Today it
  was worse, it kept restarting untill I uninstalled the app.

  I tried to search about this behaviour online and found that too 
  many
  wakelocks may coz thephonetorestart. Can there be any other reason?

  Is the above code right? Should make wl as a final variable? Does 
  the
  service call onDestroy method whenphoneshuts down?

  I am using a broadcastreceiver to start my service at boot up as 
  well.

  Any help would be appreciated.

  Thank You So Much



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: RssFeed Update

2010-02-03 Thread himanshu jain
@Raghavendra

Here is my code i used wake_lock and release it but it seems not to be
working :-
abstract public class WakefulIntentService extends IntentService {
abstract void doWakefulWork(Intent intent);

public static final String LOCK_NAME_STATIC =
MyCompany.DdayService.Static;
private static PowerManager.WakeLock lockStatic = null;

public static void acquireStaticLock(Context context) {
getLock(context).acquire();
}

synchronized private static PowerManager.WakeLock getLock(Context
context) {
if (lockStatic == null) {
PowerManager mgr = (PowerManager) context

.getSystemService(Context.POWER_SERVICE);
lockStatic = 
mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
LOCK_NAME_STATIC);
lockStatic.setReferenceCounted(true);
}
return (lockStatic);
}

public WakefulIntentService(String name) {
super(name);
}

@Override
final protected void onHandleIntent(Intent intent) {
doWakefulWork(intent);
getLock(this).release();
}
}

I used alram manger for repeating the process that manager call
onAlarmReceiver which calls my service which had dowakfulwork
function

but after sometimes it throws network unreachable may be due to wifi
network not available, I have a question can we really implement
background service that updates indefinitely even if phone is in sleep
mode .?



thanks

On Feb 3, 2:19 am, raghavendra k raghavendrar...@gmail.com wrote:
 Hi,

     Have you used partial wake lock? I got the similar problem in my
 app. I fixed it by using wake lock. Following is my code snippet. May
 be this will help you.

 PowerManager.WakeLock wl;
                 try {
                         PowerManager pm = (PowerManager) context
                                         
 .getSystemService(Context.POWER_SERVICE);
                         wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, 
 Nyros);
                         if (wl != null)
                                 wl.acquire();
                         //do your stuff here

                 } catch (Exception ex) {

                 } finally {
                         if (wl != null)
                                 wl.release();

                 }

 Thanks  Regards,
 Raghavendra K.

-- 
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] RssFeed Update

2010-02-02 Thread himanshu jain
HI Folks

   I am currently developing RssFeed app , i have one issue .I
want to implement background service ,but what happen after some times
it throughs Scoket.net exception,this was due to fact wifi goes in
sleep mode and my app can not connect to server,In order to rid of
this i thought of using wake_lock but this may not work  because wifi
can go to sleep mode before i get wake_lock.

Is there way to keep wifi awake or this is the only solution for my
issue.

I want to implement service indefinitely not when my app is active.

any help appreciated

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