[android-developers] How to successfully “Generate a Notification Key on the Client” with GCM?

2015-02-13 Thread pushbit
 

I'm following the below instructions, but the response is always HTTP 401 
Unauthorized. I have verified that the ID token, registration ID, and 
project ID (number) are all valid. Unfortunately the response does not 
provide a detailed reason.

https://developer.android.com/google/gcm/notifications.html#gen-client

What is necessary to receive an HTTP 200 response with the 
notification_key? I'm wondering if the documentation is missing an 
important detail or if there is a known issue with the service. Otherwise 
GCM and the Google auth token are working fine for me.

Here is a redacted net log. Does the request require any other headers or 
JSON fields that are not specified in the documentation?

--- HTTP POST https://android.googleapis.com/gcm/googlenotification
project_id: {project-number}Content-Type: application/json; 
charset=UTF-8{id_token:{long-auth-token},notification_key_name:{unique-name},operation:add,registration_ids:[{reg-id}]}
--- HTTP 401 https://android.googleapis.com/gcm/googlenotification

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Empty EditText when turning screen on and Screen lock set to 'None'

2012-10-31 Thread pushbit
As a (hopefully) temporary fix, I have included the following line in 
onResume() and it appears to do the trick.  Initially I tried to only run 
this when the IME isFullscreenMode(), but this returns false in onResume 
(after returning true in onPause()).  I would guess that this is part of 
the root of the problem.  When system Screen lock is None and the screen is 
turned on, the IME doesn't know that it's in full screen mode when it 
actually is.

((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
.restartInput(getCurrentFocus());

pb

Open Source Android App
Dining Out (with 
friends)https://play.google.com/store/apps/details?id=net.sf.diningout 


On Wednesday, 31 October 2012 00:06:32 UTC+1, pushbit wrote:

 Yes, the EditText has an android:id.  I've found this problem with a 
 variety of EditText and AutoCompleteTextView configurations, but only when 
 the system Screen lock setting is set to 'None'.  Everything works fine 
 when it's set to Slide or Pattern, so I suspect that the lack of a screen 
 lock is the source of this problem.  Though if possible, I would like to 
 find a way to work around this, as the Message app seems to be able to do.

 On 30 October 2012 23:44, Michael Chan mc...@android.com wrote:

 Do you have an android:id set for the EditText?
 See 
 http://developer.android.com/reference/android/view/View.html#attr_android:saveEnabled

 On Tue, Oct 30, 2012 at 3:36 PM, pushbit push...@gmail.com wrote:
  I'm having a problem where an EditText in landscape/full screen mode 
 becomes
  empty after turning the screen off and then on when the system Screen 
 lock
  is set to 'None'.  The keyboard remains active, but it doesn't appear to
  have focus and no text updates are displayed on the screen.  If I press
  'Done' or rotate to portrait, then the full screen editor is removed 
 and I
  can see the previously entered text in the normal EditText view.  I'm
  reproducing this on JB on both the emulator and a device.
 
  I found the same problem in Calendar, but not in Messaging.  When 
 editing an
  SMS message in landscape/full screen mode and then turning the screen
  off/on, at first the message appears to be empty, but then it returns 
 after
  a second.  I reviewed the source code below, but I didn't see anything
  special in onResume() that looked to be addressing this issue.
 
  
 https://github.com/android/platform_packages_apps_mms/blob/master/src/com/android/mms/ui/ComposeMessageActivity.java
 
  Does anyone know how to properly fix this, so that when Screen lock is
  'None' you can edit text in landscape/full screen mode, turn the screen 
 off
  and then back on, and the text is displayed just as you left it?
 
  Thanks,
  pb
  
  Open Source Android App
  Dining Out (with friends)
 
  --
  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




-- 
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] Empty EditText when turning screen on and Screen lock set to 'None'

2012-10-30 Thread pushbit
I'm having a problem where an EditText in landscape/full screen mode 
becomes empty after turning the screen off and then on when the system 
Screen lock is set to 'None'.  The keyboard remains active, but it doesn't 
appear to have focus and no text updates are displayed on the screen.  If I 
press 'Done' or rotate to portrait, then the full screen editor is removed 
and I can see the previously entered text in the normal EditText view.  I'm 
reproducing this on JB on both the emulator and a device.

I found the same problem in Calendar, but not in Messaging.  When editing 
an SMS message in landscape/full screen mode and then turning the screen 
off/on, at first the message appears to be empty, but then it returns after 
a second.  I reviewed the source code below, but I didn't see anything 
special in onResume() that looked to be addressing this issue.

https://github.com/android/platform_packages_apps_mms/blob/master/src/com/android/mms/ui/ComposeMessageActivity.java

Does anyone know how to properly fix this, so that when Screen lock is 
'None' you can edit text in landscape/full screen mode, turn the screen off 
and then back on, and the text is displayed just as you left it?

Thanks,
pb

Open Source Android App
Dining Out (with 
friends)https://play.google.com/store/apps/details?id=net.sf.diningout

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

Re: [android-developers] Empty EditText when turning screen on and Screen lock set to 'None'

2012-10-30 Thread pushbit
Yes, the EditText has an android:id.  I've found this problem with a
variety of EditText and AutoCompleteTextView configurations, but only when
the system Screen lock setting is set to 'None'.  Everything works fine
when it's set to Slide or Pattern, so I suspect that the lack of a screen
lock is the source of this problem.  Though if possible, I would like to
find a way to work around this, as the Message app seems to be able to do.

On 30 October 2012 23:44, Michael Chan mc...@android.com wrote:

 Do you have an android:id set for the EditText?
 See
 http://developer.android.com/reference/android/view/View.html#attr_android:saveEnabled

 On Tue, Oct 30, 2012 at 3:36 PM, pushbit push...@gmail.com wrote:
  I'm having a problem where an EditText in landscape/full screen mode
 becomes
  empty after turning the screen off and then on when the system Screen
 lock
  is set to 'None'.  The keyboard remains active, but it doesn't appear to
  have focus and no text updates are displayed on the screen.  If I press
  'Done' or rotate to portrait, then the full screen editor is removed and
 I
  can see the previously entered text in the normal EditText view.  I'm
  reproducing this on JB on both the emulator and a device.
 
  I found the same problem in Calendar, but not in Messaging.  When
 editing an
  SMS message in landscape/full screen mode and then turning the screen
  off/on, at first the message appears to be empty, but then it returns
 after
  a second.  I reviewed the source code below, but I didn't see anything
  special in onResume() that looked to be addressing this issue.
 
 
 https://github.com/android/platform_packages_apps_mms/blob/master/src/com/android/mms/ui/ComposeMessageActivity.java
 
  Does anyone know how to properly fix this, so that when Screen lock is
  'None' you can edit text in landscape/full screen mode, turn the screen
 off
  and then back on, and the text is displayed just as you left it?
 
  Thanks,
  pb
  
  Open Source Android App
  Dining Out (with friends)
 
  --
  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


-- 
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: OnDateChanged broken in ICS. Anyone have a work around?

2012-09-19 Thread pushbit
The updateDate method will call onDateChanged and if the time comparison 
logic isn't just right then this could lead to infinite recursion and a 
StackOverflowError.  I would guess that there's a discrepancy between the 
Calendar millis and the Date millis.  This could be tricky to get right 
unless you're very diligent about setting every time field on both sides 
down to the millisecond.  In the code below, newDate will have the current 
hours, minutes, seconds, and milliseconds, since it hasn't been clear()ed.  
The milliseconds from newDate will be greater than the milliseconds from 
maxDate if maxDate was created with only day precision (time will be 
00:00:00.000).

Would it work if you simplified this to get the desired date and then use 
that for the super() and init() params?  According to the 4.1 sources, it 
shouldn't be necessary to call updateDate, but I'm not sure about older 
versions.

pb

Open Source Android App Developer
Dining Out (with friends) - The History and Future of Your 
Foodhttps://play.google.com/store/apps/details?id=net.sf.diningout 


On Tuesday, 18 September 2012 20:53:27 UTC+2, darrinps wrote:

 I tried that and it blows it up with a stack overflow every time.

 Here is what I did:

 public void onDateChanged(DatePicker view, int year, int monthOfYear, int 
 dayOfMonth) 
 {
 Calendar newDate = Calendar.getInstance();
 newDate.set(year, monthOfYear, dayOfMonth);

 if (newDate.getTimeInMillis()  minDate.getTime()) 
 {
 newDate.setTime(minDate);
 view.updateDate(newDate.get(Calendar.YEAR), 
 newDate.get(Calendar.MONTH), newDate.get(Calendar.DAY_OF_MONTH));
 }
 else if (newDate.getTimeInMillis()  
 maxDate.getTime()) 
 {
 newDate.setTime(maxDate);
 view.updateDate(newDate.get(Calendar.YEAR), 
 newDate.get(Calendar.MONTH), newDate.get(Calendar.DAY_OF_MONTH));
 }
 else 
 {
 super.onDateChanged(view, year, monthOfYear, 
 dayOfMonth);
 view.init(year, monthOfYear, dayOfMonth, this);
 }

 Once you hit a scroll button it goes to never never land for a few seconds 
 then crashes. I tried a couple other permutations too with the same result.



 On Tuesday, September 18, 2012 3:31:37 AM UTC-5, pushbit wrote:

 I noticed that this bug is fixed in JB.  But for ICS, I believe you can 
 fix the bug yourself in your DatePickerDialog subclass.  Override 
 onDateChanged and after super.onDateChanged() call view.init(year, month, 
 day, this).  Unfortunately init will be called twice, but the second time 
 should restore your DatePickerDialog as the OnDateChangedListener.

 pb
 
 Open Source Android App Developer
 Dining Out (with friends) - The History and Future of Your 
 Foodhttps://code.google.com/p/dining-out/ 


 On Monday, 17 September 2012 20:25:20 UTC+2, darrinps wrote:

 Looks like onDateChanged never gets called in ICS (and above I assume) 
 after the very first time the DatePickerDialog is displayed. Here is a bug 
 that has been filed: 
 http://code.google.com/p/android/issues/detail?id=25838

 I tried the work around suggested in it (not calling 
 super.onDateChanged) but that resulted in a stack overflow, so, does anyone 
 have a suggestion to get OnDateChanged working with older versions of 
 Android (targeting 2.2 and above) running on devices with ICS installed?

 Again, everything works fine with onDateChanged up until version 14. 
 After that, the call back never takes place. I need to know when the dialog 
 has had its date changed.

 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: OnDateChanged broken in ICS. Anyone have a work around?

2012-09-18 Thread pushbit
I noticed that this bug is fixed in JB.  But for ICS, I believe you can fix 
the bug yourself in your DatePickerDialog subclass.  Override onDateChanged 
and after super.onDateChanged() call view.init(year, month, day, this).  
Unfortunately init will be called twice, but the second time should restore 
your DatePickerDialog as the OnDateChangedListener.

pb

Open Source Android App Developer
Dining Out (with friends) - The History and Future of Your 
Foodhttps://code.google.com/p/dining-out/ 


On Monday, 17 September 2012 20:25:20 UTC+2, darrinps wrote:

 Looks like onDateChanged never gets called in ICS (and above I assume) 
 after the very first time the DatePickerDialog is displayed. Here is a bug 
 that has been filed: 
 http://code.google.com/p/android/issues/detail?id=25838

 I tried the work around suggested in it (not calling super.onDateChanged) 
 but that resulted in a stack overflow, so, does anyone have a suggestion to 
 get OnDateChanged working with older versions of Android (targeting 2.2 and 
 above) running on devices with ICS installed?

 Again, everything works fine with onDateChanged up until version 14. After 
 that, the call back never takes place. I need to know when the dialog has 
 had its date changed.

 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: expandable list group view

2012-09-18 Thread pushbit
If a button is covering the list item, then its OnClickListener would 
likely consume the touch event.  If you want the list item to also be 
clicked, then I think you will have to manually notify the 
{Group,Child}ClickListeners from your button OnClickListener(s).  Or if you 
can just use an ImageView instead of ImageButton, then the touch event 
should fall through to the list item.

pb

Open Source Android App Developer
Dining Out (with friends) - The History and Future of Your 
Foodhttps://code.google.com/p/dining-out/ 


On Monday, 17 September 2012 14:29:36 UTC+2, sindhu wrote:

 Hi all, am using expandable listview with image button in both group item 
 and child item but the problem is when i add the image button or button the 
 callback methods setOnGroupClickListener, setOnChildClickListener are not 
 getting called so that am not able to select the list item, is any one know 
 the answer please help me. 

-- 
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 use drawable resource in custom XML?

2012-09-18 Thread pushbit
What about getAttributeResourceValue()?  I haven't tried this method, but 
from the docs it appears that it should work.

For others (and to note what I just learned today), you can use 
Resources.getXml to get an XmlResourceParser for your custom xml files (in 
res/xml/) and in addition to XmlPullParser, this interface also extends 
AttributeSet, which provides useful resource related methods like the above.

pb

Open Source Android App Developer
Dining Out (with friends) - The History and Future of Your 
Foodhttps://play.google.com/store/apps/details?id=net.sf.diningout 


On Thursday, 10 September 2009 00:12:33 UTC+2, Robi wrote:

 Hey guys, 

 so I have an XML file: xml/catalog.xml 
 which contains gallery and pictures. 

 Like this: 

 ?xml version=1.0 encoding=utf-8 standalone=yes? 
 catalog xmlns:myres=http://schemas.android.com/apk/res/android; 

 gallery title=@string/gallery01 
 thumbnail=@drawable/t_gallery1 
 picture thumbnail=@drawable/pic_01 
 /picture 
 picture thumbnail=@drawable/pic_02 
 /picture 
 picture thumbnail=@drawable/pic_03 
 /picture 
 /gallery 
 /catalog 

 In my view I can extract the attribute values using getAttributeValue 
 () in XmlPullParser, and the result is a string. 
 But could I somehow get the drawable resource right away? (That's why 
 I put the @ in the beginning) 

 getAttributeNameResource() gives null so that ain't good. 

 Any ideas? 


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

[android-developers] Re: My AVD is super slow

2012-09-18 Thread pushbit
For API level 14+, try adding hw.gpu.enabled: yes.  If you have a decent 
video card/chip, it should make the UI, at least, much faster and smoother.

pb

Open Source Android App Developer
Dining Out (with friends) - The History and Future of Your 
Foodhttps://play.google.com/store/apps/details?id=net.sf.diningout 


On Saturday, 15 September 2012 05:37:50 UTC+2, _Chilling wrote:

 Hi All,

 I am pretty new to Android SDK. I am trying to write my first hello world 
 program. The AVD that I have created is super slow in performance and I am 
 pretty sure this is not ow a real world phone performs.

 Any tips on making this better ?

 My AVD is set up as

 Android 4.0.3 // assuming this is the current biggest market share and the 
 right decision to code against
 CPU ARM
 SD card size 512 mB
 Skin - Default WVGA800

 lcd density: 240
 cpumodel: cortex-a8
 vm.headsize:48
 vm.ramsize: 512



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