Skip to content

Instantly share code, notes, and snippets.

View jtowle's full-sized avatar

Jeff Towle jtowle

  • Airship
  • Portland, Oregon
View GitHub Profile
@jtowle
jtowle / AndroidManifest.xml
Created November 3, 2012 17:00
Manifest for Helium Apps
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="com.urbanairship.push.sample">
<!-- minSdkVersion sets runtime compatibility ("will run on API level 4") -->
<!-- targetSdkVersion should be set to the latest version tested, to disable compatibility modes
("was tested with API level 9 features") -->
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="9"/>
@jtowle
jtowle / UANewsstandHelper.m
Created August 26, 2011 18:25
UANewsstandHelper.m
/*
Copyright 2009-2011 Urban Airship Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
@jtowle
jtowle / UANewsstandHelper.h
Created August 26, 2011 18:24
UANewsstandHelper.h
/*
Copyright 2009-2011 Urban Airship Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binaryform must reproduce the above copyright notice,
@jtowle
jtowle / gist:1174030
Created August 26, 2011 18:15
Newsstand App Delegate's Push Arrived Handler
// Copy and paste this method into your AppDelegate to recieve push
// notifications for your application while the app is running.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
UALOG(@"did receive remote notification: %@", userInfo);
[[UAirship shared].analytics handleNotification:userInfo];
[newsstand handleNewsstandPushInfo:userInfo];
}
@jtowle
jtowle / gist:1174024
Created August 26, 2011 18:13
Newsstand App Delegate's applicationDidFinishLaunchingWithOptions
/***********************************************
* In application:DidFinishLaunchingWithOptions:
************************************************/
// Set up newsstand helper
// newsstand is an ivar - you will need to declare it in your header and
// release it in dealloc
newsstand = [[UANewsstandHelper alloc] init];
@jtowle
jtowle / gist:1174022
Created August 26, 2011 18:11
Disable Newsstand Push Throttling
// For debugging - allow multiple pushes per day
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NKDontThrottleNewsstandContentNotifications"];
@jtowle
jtowle / gist:1174016
Created August 26, 2011 18:09
Register for Newsstand Notification
// Register for notifications
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeNewsstandContentAvailability | // Newsstand type <---
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
@jtowle
jtowle / gist:1173993
Created August 26, 2011 18:05
Newsstand Background Info.plist Addition
To enable newsstand:
<key>UINewsstandApp</key>
<true/>
To enable background downloads:
<key>UIBackgroundModes</key>
<array>
<string>newsstand-content</string>