|
Tweets
|
|
Repositories
|
|
Posts
|
Remote Push Notification is a push technology to forward notifications from servers to Apple devices. To send notifications, you need to implement server application which communicate with Apple Push Notification Service (APNS).
The APNS protocol is defined in Apple's developer documentation. In addition, there are already some libraries for communicating with APNS.
If you use Java for programming server-side application, use java-apns. It's simple to use and also easy to import from Play framework's dependency management system.
[PlayApp]/conf/dependencies.yml
# Application dependenciesrequire:
- play
- com.notnoop.apns -> apns 0.1.6
Then, type "play dependencies" command on a play application directory, the libraries will automatically install from repositories. Now, ready to use APNS in your play application.
You can easily send each notification in play framework's Controllers class or Jobs class like below:
import models.*;
public static void sendNotification(Long id) {
import play.libs.Codec;
import play.vfs.VirtualFile;
import com.notnoop.apns.APNS;
import com.notnoop.apns.ApnsService;
// Creating a notification payload
String payload = APNS.newPayload()
.alertBody("Message ...")
.badge(1)
.sound("default")
.build();// Resolve file path for a certification file
// Send notification
VirtualFile certFile = VirtualFile.fromRelativePath("/APNDevCert.p12");
// Configuration with certification and APNS sandbox environment
ApnsService service = APNS.newService() .withCert(certFile.getRealFile().getAbsolutePath(), "p12password")
.withSandboxDestination()
.build();
// Retrieve the registered device token from model.
String base64encodedToken = Device.findById(id).deviceToken;
byte[] deviceToken = Codec.decodeBASE64(base64encodedToken);
service.push(deviceToken, payload.getBytes());}
It worked on local development environment and heroku environment as well.
You may know "Doorway transition effect" if you use Keynote which is excellent presentation software from Apple. Twitter app also has implemented this transition effect in first account registration view in their iPhone application.
I made experimental code of Doorway Transition in CoreAnimation framework. Please check this out on my github.
https://github.com/mkftr/DoorwayTransition
All I wrote for this effect is "MFDoorwayTransition" class. You can apply this effect easily in between two views like below :
MFDoorwayTransition *transition = [[MFDoorwayTransition alloc]
initWithBaseView:self.view
firstView:self.currentView
lastView:self.nextView];
[transition buildAnimation];
[transition release];
Please feel free to use this experimental code.
|
Videos
|