Closed GoogleCodeExporter closed 9 years ago
And the deviceId received in the registeredForPush() method call for the
Android device is given below:
APA91bEGGy-IEO0JXGGRwzLnHgngKHacbwm3-quT-EUXVTqDfa7f3SrArH3Xv7ev3cxURCXAPgA70Pdg
Gh75DawxZRDowtkNdISaDmJTQ1EyfLIS0RwYiRKXXjNPIvr__bGRgU9bAiZuVuIS9KnpEh86l0P4Cr92
7A
Original comment by nir...@nvsoft.com
on 20 Jul 2013 at 5:22
Original comment by shai.almog
on 20 Jul 2013 at 5:29
Looking at the code, is it possible that this only happens to you the first
time around and after that it works?
There is a delay between receiving the native push ID and the actual final push
registration in the server. This is probably something we need to fix.
Anyway, I'll update the server within the next couple of hours with some
logging, if you could then reproduce the problem and attach the DDMS logs that
could be helpful in pinpointing the source of the issue.
Original comment by shai.almog
on 21 Jul 2013 at 7:55
FYI I updated the server and included a fix for the callback being
asynchronous. I also made an additional improvement to the backend server.
Original comment by shai.almog
on 21 Jul 2013 at 9:46
I added some more logs to my app and it seems the cn1 push id is null initially
when my app receives the registeredForPush callback. However afterwords it is
getting some value. I got a value of 14196178 for the iphone 4 device above.
However when I try to use this id and call the server side method to push the
notification to this device, it seems to be hanging and the thread on which
this is called, just don't return. This method is used for pushing the msg:
Push.sendPushMessage(notificationMsg, cn1PushDeviceId, isProdEnv,
googleServerKey, iosPushCertURL, iosPushCertPassword);
Original comment by nir...@nvsoft.com
on 21 Jul 2013 at 7:02
If you sent a build in the past 9 hours the problem of asynchronicity should be
fixed. The callback should arrive after we have server response from the cloud.
Send push is a blocking method, is it possible there are other network
operations preventing it from running? Are you invoking it from another network
operation?
Original comment by shai.almog
on 21 Jul 2013 at 7:24
I have been building my app against the server cn1 version 1.1. Do I need to
build against latest version to get this fix?
Original comment by nir...@nvsoft.com
on 22 Jul 2013 at 4:58
We can't fix the 1.1 version otherwise we would be bound to add regressions. We
don't change the 1.1 version at all in the servers to avoid such cases.
Original comment by shai.almog
on 22 Jul 2013 at 5:02
ok, I will try with the latest version. There is one more question I had
regarding push to android device:
In the KitchenSink demo, the code uses the following code to send push msg to a
device:
com.codename1.push.Push.sendPushMessage("Hi Kitchen Sink users!", devKey,
false, GOOGLE_SERVER_KEY, IOS_CERTIFICATE_URL, IOS_CERTIFICATE_PASSWORD);
However the documentation on Push class, mentions GOOGLE_AUTH_KEY
(googleAuthKey - authorization key from the google play store) as the argument
to be passed to sendPushMessage method call. Can you please confirm which key
we are suppose to use here?
Original comment by nir...@nvsoft.com
on 22 Jul 2013 at 5:15
The docs are in error. This needs to be the keys from the cloud API console.
Original comment by shai.almog
on 22 Jul 2013 at 5:20
I tested with the latest code on iPhone. Now, the cn1 push device id is not
coming as null. However another problem is that the iphone app is not
registered for push notification. Earlier build would cause the apple iOS to
ask for user permission to enable notification and the app would also show up
on the notifications list in the settings of the iphone. However with latest
version is not asking for the push registration permission and the app is also
not showing up in the notifications center. However the registeredForPush
callback is getting called and the following device ids are getting being shown:
Native device id:
b018aa2534e7abf5da59f9c673e255eb107cf3f771022db31d3a215c8e8f4c8b
cn1PushDeviceId: 13815159
Can you please advice what is the issue here?
Original comment by nir...@nvsoft.com
on 22 Jul 2013 at 6:56
Did you define ios.includePush=true in the build args?
When sending a build with sources included if you open IOSNative.m do you see
the line #define INCLUDE_CN1_PUSH2 defined there or is it missing?
Original comment by shai.almog
on 22 Jul 2013 at 8:39
Yes, the ios.includePush=true in the build args.
And IOSNative.m has the following line:
#define INCLUDE_CN1_PUSH2
Original comment by nir...@nvsoft.com
on 22 Jul 2013 at 9:47
Make sure you are using a proper mobile provisioning file that doesn't use * in
the package name. I'm assuming you are using the development not production
build right?
Open your ipa using a zip application then find the file
embedded.mobileprovision, open it in the text editor where you should see a
section like this:
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>Q5GHSKAL2F.com.codename1.demos.kitchen</string>
<key>aps-environment</key>
<string>development</string>
<key>get-task-allow</key>
<true/>
Can you verify that the values there make sense (you will see a lot of other
giberish around) and ideally post it here too?
Original comment by shai.almog
on 22 Jul 2013 at 10:40
I am using the "Send iOS AppStore build" target in netbeans for building.
However since this build is used for testing currently, during sendPushMessage
- I am passing production as false.
My provisioning profile is correct, and package name does not contains a "*" in
the end. Actually I am using the same provisioning profile to build against
version 1.1 and it works(in the sense app is added in the notification center).
However for the latest version build, it is not added.
I have pasted the values from my embedded.mobileprovision file from the ipa
built using the latest version:
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>KF4G994665.com.nvsoft.s2pay</string>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>KF4G994665.*</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2014-04-09T07:34:50Z</date>
However the app installed using this ipa file, does not go into the
notification center.
Original comment by nir...@nvsoft.com
on 22 Jul 2013 at 10:52
This won't work for you, as you can see your build is marked as production
still. You can only do sandbox pushes during development. If you switch to a
development build will it appear in the notification center?
I'm not sure how it works for you with 1.1 since the main thing we change there
is the libraries.
Original comment by shai.almog
on 22 Jul 2013 at 11:05
I also did a build with development target and latest version and here are the
Entitlements from it:
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>KF4G994665.com.nvsoft.s2pay</string>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.default-data-protection</key>
<string>NSFileProtectionComplete</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>KF4G994665.*</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2014-04-10T07:26:20Z</date>
It is also not showing in the push notification center.
Original comment by nir...@nvsoft.com
on 23 Jul 2013 at 9:50
Are you getting a pushRegistrationError() call?
I looked at the push registration code and can't see anything that's different
and as far as I can tell its not the code that should put you in the
notification center. However, I did notice the code is executed on our thread
instead of Apples thread so I am in the process of moving the code to Apples
thread which I hope would resolve the issue (because I'm seriously fresh out of
guesses).
I'll update the issue once I've uploaded this change to the server.
Original comment by shai.almog
on 23 Jul 2013 at 10:44
No I am not getting the pushRegistrationError() call. It is calling
registeredForPush() call.
Thanks Shai, I have been trying to get push to work but somehow not been
successful and getting it work, would help a lot.
Original comment by nir...@nvsoft.com
on 23 Jul 2013 at 11:42
I've updated the server, hopefully this will fix the issue.
Original comment by shai.almog
on 23 Jul 2013 at 12:13
Hi Shai,
I tried with the latest code. Now the app is showing in the notification
center.
However when I tried to send push message to it (in the development version),
the app is not getting the message. The boolean result from the following call
is coming as "true" but message is not received:
com.codename1.push.Push.sendPushMessage("Hi Kitchen Sink users!", devKey,
false, GOOGLE_SERVER_KEY, IOS_CERTIFICATE_URL, IOS_CERTIFICATE_PASSWORD);
Original comment by nir...@nvsoft.com
on 23 Jul 2013 at 1:51
FYI, the latest code which I tried has the following cn1 push id: 13859734.
Original comment by nir...@nvsoft.com
on 23 Jul 2013 at 1:53
Let me do a little dance for resolving the first issue ;-) Tough one!
I think I see the second issue, it seems like a memcache issue on the server
and you should have gotten the message now. I'm working on fixing it.
Original comment by shai.almog
on 23 Jul 2013 at 6:51
OK. Workaround for that issue should be up too.
Original comment by shai.almog
on 23 Jul 2013 at 6:57
Tried with latest build, but Sorry, still haven't received the push messages.
The latest native id and cn1 push id are shown here:
native id: 3a31e625a8b3437625957d6a15f7bbfc4e88a6991cfeb29f9c0d1383b908d889
cn1PushId: 13859734
The result from sendPushMessage, still shows "true" but no message on the
client app.
Anything else can be checked?
Original comment by nir...@nvsoft.com
on 24 Jul 2013 at 5:55
Push.sendPushMessage() call works from mobile app. However when I try to call
the same using JavaSEPort in my Web application, it is failing. Actually, when
it is trying to get the following property:
Display.getInstance().getProperty("built_by_user", "");
It is waiting for the user input at the following line:
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:503)
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:247)
- locked <0x0000000784c9b2c0> (a java.awt.Component$AWTTreeLock)
at java.awt.Dialog.show(Dialog.java:1072)
at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:870)
at javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:796)
at javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:758)
at com.codename1.impl.javase.JavaSEPort.getProperty(JavaSEPort.java:3415)
at com.codename1.ui.Display.getProperty(Display.java:2363)
How to avoid this? As I am running in a web app and JavaFx is not there nor
user can input anything.
Original comment by nir...@nvsoft.com
on 24 Jul 2013 at 12:06
Just use Display.getInstance().setProperty("built_by_user", emailOfProUser);
Original comment by shai.almog
on 24 Jul 2013 at 5:44
ok, with setProperty, now the server is also able to make the sendPushMessage()
call.
However, still no push message is received on the mobile device. Does it show
any error on the server side?
Original comment by nir...@nvsoft.com
on 25 Jul 2013 at 1:44
Which mobile? I thought you were able to push from the device?
Is it not working to Android or to iOS?
Which device id's?
Original comment by shai.almog
on 25 Jul 2013 at 6:39
From iPhone IOS the same device I'd and cn1 push device Id that I mention
earlier. The sendPushMessage call returns true(when called from device or from
server), but the mobile device is not able to get any of the push messages.
Original comment by nir...@nvsoft.com
on 25 Jul 2013 at 10:36
Thanks Shai,
Now the push messages are coming to the iPhone device. Will test android and
let you know.
Original comment by nir...@nvsoft.com
on 26 Jul 2013 at 2:57
Push on android device is also working now. Thanks
Original comment by nir...@nvsoft.com
on 26 Jul 2013 at 2:09
Further update, actually my app's push() method of the PushCallback does not
seem to be called when the app is running. I am now seeing the push messages
(in iPhone) when the app is not running or it is in the background. But when
the app is in the foreground the push messages are not being received or
probably method on my callback is not getting called. How should I debug this?
Original comment by nir...@nvsoft.com
on 27 Jul 2013 at 2:54
Interesting. Did you implement the PushCallback interface on the main class?
Is this only on iOS or on Android too?
Original comment by shai.almog
on 27 Jul 2013 at 6:56
I have implemented the PushCallback on main app class as well as statemachine.
From main app class I am calling the method in statemachine class.
I will test the behavior on android tomorrow.
Original comment by nir...@nvsoft.com
on 28 Jul 2013 at 4:31
I tested the behaviour on android phone and it is also not getting the push
message if the application is in the foreground.
I put debug statements on my main application class which implements the
PushCallback, but even those debug stmts are not coming when the app is in the
foreground.
Can you please help?
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 12:23
When I tried to debug the application on iphone, I put a breakpoint on the
following method(objC):
com_codename1_impl_ios_IOSImplementation_pushReceived
However, when the app is in the foreground - this method is not getting called
when push message is sent to the device.
Can you please provide some guidance as to which method should be called so
that I can put a breakpoint on that method.
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 12:49
Check out CodenameOne_GLAppDelegate.m: didReceiveRemoteNotification
From your previous posts I understood that this did work? What changed?
Did it only work when the app was in the background?
Original comment by shai.almog
on 29 Jul 2013 at 1:33
Yes, the push notification works only when app is in the background.
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 2:12
If it were only on iOS or only on Android I'd assume its a bug in the platform
but since it doesn't work for neither I'm assuming something went wrong
elsewhere. How are you sending the push?
Original comment by shai.almog
on 29 Jul 2013 at 3:16
I am sending the push using the server side code:
Push.sendPushMessge()
The same server side code to push msg works when the app is in the background
or not running.
However when the app is running in foreground it does not get the push msg.
I believe it might be some issue on the client side. However the behavior is
the same in android and iOS. Hence I am not sure how to debug?
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 4:12
Is it working for you if you send a push from the simulator/device?
Is it possible you have an old version of the JavaSE jar?
Original comment by shai.almog
on 29 Jul 2013 at 4:32
I have not tried push from the device/simulator. I will try that.
From server side the push seems to be going and received at the client when app
is not in foreground. So I think the push must be going from server but some
logic on client is causing it to not show when app is running in foreground. Do
you think, logic on server will make difference in this situation? My
javase.jar will be about 3 to 4 days old then the latest jar.
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 5:01
Not if its 4 days old. An older version might have had a different default
"type" attribute that might have hidden the value received but the newer
version should be the same for the most part. Did you place a breakpoint in the
method I mentioned in the objective C code? Does it get invoked?
Original comment by shai.almog
on 29 Jul 2013 at 5:38
On putting the breakpoint on CodenameOne_GLAppDelegate.m:
didReceiveRemoteNotification:
This method is getting invoked when msg is pushed to the device. However the it
does not enter any of the two if blocks in the method. I have attached the
screenshot which shows the object value of the userInfo.
Can you see any issue there?
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 6:05
Attachments:
And for your information, the JavaSE.jar in my server is having files which are
having date of Jul 10.
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 6:23
Can you move this log:
NSLog(@"Received notification: %@", userInfo);
So it will print out and get the printout from the console so I can see the
message contents you are receiving?
Thanks.
Original comment by shai.almog
on 29 Jul 2013 at 7:21
Here's the output after moving the log:
2013-07-30 03:25:36.000 S2PayApp[3613:907] Received notification: {
aps = {
alert = "{\"ID\":\"1520041\",\"CB\":\"oYtZYpdRuGty9dZKz9IY8hS0GcgRiwU91m6qTOgrieHDXYzF67rZb6Ytj8V+jo+kZ4jA06DudGZAKANvZVi7sQ==\",\"TYPE\":\"NCN\"}";
};
}
Original comment by nir...@nvsoft.com
on 29 Jul 2013 at 9:57
This might be a client side issue after all. Can you change:
if( [apsInfo objectForKey:@"alert"] != NULL)
To:
if( [[userInfo valueForKey:@"aps"] valueForKey:@"meta"] != NULL)
And see is this solves the issue on iOS?
Original comment by shai.almog
on 30 Jul 2013 at 4:50
When I changed:
if( [apsInfo objectForKey:@"alert"] != NULL)
TO:
if( [apsInfo objectForKey:@"aps"] != NULL)
It started working.
The next if block is using the following check:
if( [userInfo objectForKey:@"meta"] != NULL)
Do you mean to change that? As there is no "meta" key in the UserInfo received
by client.
Original comment by nir...@nvsoft.com
on 30 Jul 2013 at 5:12
Original issue reported on code.google.com by
nir...@nvsoft.com
on 20 Jul 2013 at 5:13