Display only mail apps when calling ACTION_SEND intent

Maybe you have already noticed, that if you invoke the mail sender intent on Android, it may display a lot of installed apps, which can handle text/plain MIME-types, that may confuse the user.
To display only mail-capable apps, use message/rfc822 as the parameter of setType method.

Via Stackoverflow.com

EmailShare

Android Toast-like HUD for iOS

If you wish to easily report status of background processes to the user, on Android you may use Toast class, however iOS lacks of this great feature. But there is a great library, that provides even more features than Android version: MBProgressHUD.

EmailShare

Adding settings bundle to iOS app

If you want to add your app’s settings to the main iOS settings page, there are some pretty easy and straightforward steps to do it, which is presented very well in the following tutorial.

EmailShare

“Real” URL encoding in iOS

Sometimes if you wish to encode a whole URL including /,&,: , [NSString stringByAddingPercentEscapes:] fails, to solve this issue, use CFURLCreateStringByAddingPercentEscapes

+ (NSString*)urlEncode: (NSString*) url {
NSString* encoded = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)url, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8);
return [encoded autorelease];
}

Source

EmailShare

Android 3.x Action Bar customization

The ActionBar UI component has been introduced in Android 3.0 and above, and it seems to become the standard way to use tabs and context/action menus in Android applications.
You may also customize the ActionBar associated to your application in different ways through this great tutorial, however you might run into errors when you wish to override Tab item styles, to resolve this issue,
check this blog for a very straightforward solution. (due to private API issues)

EmailShare

Quicklook plugin for iOS provision files

Must have for iOS developers :)

EmailShare

Calculating angle between two GPS positions

Easy way to determine bearing/angle between two locations:
Source: Stackoverflow.com

----- CLLocation+Bearing.h

#import
#import

@interface CLLocation (Bearing)

-(double) bearingToLocation:(CLLocation *) destinationLocation;
-(NSString *) compassOrdinalToLocation:(CLLocation *) nwEndPoint;

@end
---------CLLocation+Bearing.m

#import "CLLocation+Bearing.h"

double DegreesToRadians(double degrees) {return degrees * M_PI / 180;};
double RadiansToDegrees(double radians) {return radians * 180/M_PI;};

@implementation CLLocation (Bearing)

-(double) bearingToLocation:(CLLocation *) destinationLocation {

double lat1 = DegreesToRadians(self.coordinate.latitude);
double lon1 = DegreesToRadians(self.coordinate.longitude);

double lat2 = DegreesToRadians(destinationLocation.coordinate.latitude);
double lon2 = DegreesToRadians(destinationLocation.coordinate.longitude);

double dLon = lon2 - lon1;

double y = sin(dLon) * cos(lat2);
double x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dLon);
double radiansBearing = atan2(y, x);

return RadiansToDegrees(radiansBearing);
}

EmailShare

Android push messaging – C2DM

From Android 2.2 and above, push messaging is supported like on Apple iPhone through the C2DM service. The official developer site and blog features a good client example, but this article features a complete guide with server side PHP examples as well.

EmailShare

Error adding EKEvent on iOS 5

If you try to add an EKEvent with startDate equals to endDate to EKEventStore on iOS5, it will throw an error like “No end date has been set”.
To get rid of this problem, you should add a second to endDate property, something like:

if ([event.endDate isEqualToDate:event.startDate]) {
event.endDate = [event.startDate dateByAddingTimeInterval:1.0]; // add one second
}

Source: stack overflow

EmailShare

After upgrading ASIHttpRequest, responseStatusCode returns 0

If you are using ASIHttpRequest to download large files and cache them, you may run into an issue with request.responseStatusCode value is 0 after upgrading to version 1.8.1.
To fix the issue, check this github issue.
You should replace this line in the original source code:
[self setResponseStatusCode:[[headers objectForKey:@"X-ASIHTTPRequest-Response-Status-Code"] intValue]];

EmailShare