Category Archives: Devel

Aaaaaargh! onPreviewFrame is not called on Android ICS

When using the Camera preview on android, there is a setPreviewCallback method to get the preview frames. (The API doc says it will do that.)

However, I never saw the callback is being called.

try {
	callbackBuffer = new byte[mCamera.getParameters().getPreviewSize().width * mCamera.getParameters().getPreviewSize().height * (ImageFormat.getBitsPerPixel(mCamera.getParameters().getPreviewFormat()) / 8)];
    mCamera.addCallbackBuffer(callbackBuffer);
    mCamera.setPreviewCallbackWithBuffer(this);
    mCamera.setPreviewDisplay(holder);
    mCamera.startPreview();
} catch (IOException e) {
    Log.d(TAG, "Error setting camera preview: " + e.getMessage());
}

Not works.

try {
    mCamera.setPreview(@Override
	public void onPreviewFrame(byte[] data, Camera camera) {
		Log.i(TAG, "preview");
	}
    });
    mCamera.setPreviewDisplay(holder);
    mCamera.startPreview();
} catch (IOException e) {
    Log.d(TAG, "Error setting camera preview: " + e.getMessage());
}

Nope.

I could find a bug report about it.
onPreviewFrame never called when using setPreviewCallback

It seems like a bug on Android ICS, but it’s not clear which version is fixed. My device is 4.1.2 and just not working, and there will be so many people with ICS, because the Android device manufacturers doesn’t provide the OS update for the customers.
And android OS developers are not providing any explanation or the workaround to avoid it.

Developing on Android is just a mess..

Using Intel HAXM Android x86 emulator on OSX Mavericks 10.9

After the OSX Mavericks 10.9 update, Android x86 emulator will crash or freeze on start.

I updated all the SDKs on the Android SDK Manager, but it didn’t help. After some googling, it turns out I wasn’t the only person with such defect.

Intel released the HAXM hotfix for OSX 10.9 and Windows 8.1.
Info
Download page

After installing the hotfix, still my virtual devices didn’t work.
(Also be aware that you couldn’t use VirtualBox 4.2.14 simultaneously with the emulator.)

After some testing, Android 4.x emulator works well without a problem, but only the Android 2.3.3 emulator still crashes on start.

I was using the emulators with the ‘Use Host GPU’ option(because it is recommended), but disabling that option makes the Android 2.3.3 x86 emulator work.

I’m not sure whether it’s a applicable solution for all, but if you have the same problem, give it a try.

[iOS] Premium Themes are added to ‘Been Together’

As a first steps of collaborating with other designers, we are now introducing premium themes by @dahaero.

Where are the new Themes?

1. Themes can be accessed from the side menu.

BeenTogether Theme

 

2. You can go to the Themes Store by pressing the right navigation button.

Theme Store

 

3. You can see each themes and buy them. Theme pack includes all 3 themes.

Theme list

 

4. After purchase, theme will be downloaded to your list. You can select the Theme to apply it.

Theme apply

 

5. Go to the main screen and you can see the applied result.

 

New Themes

1. Cappuccino

cappuccino

 

2. Date

date

 

3. YR

yr

 

Download ‘Been Together’ Android version

Download ‘Been Together’ iOS version

[And] ‘Been Together’ now has Lock Screen!

There has been many inquiries about using ‘Been Together’ app as a lock screen. There was no such function, but people kept asking about it. I wondered where does that kind of story came from. (I guess that it is a misunderstanding of the push notifications shown on the lock screen.)

However, it seems like a desired function, so now ‘Been Together’ can be used as a lock screen! Actually Android doesn’t support changing the default lock screen, so it just works like a lock screen, not replace.

How to use ‘Been Together’ as a Lock screen

Been Together setting

 

Go to ‘Settings‘ and check ‘Use as Lock Screen‘.

Then after turning on the screen,

Been Together Lock Screen

Voila! It shows up like a Lock screen. I know the design need improvements..

Also, the default lock screen will appear together, so it will be better to disable the default lock screen from the system settings.

The lock screen doesn’t appear sometimes, so we are working out to improve the stability.

Thank you very much.

Download ‘Been Together’ Android version

Download ‘Been Together’ iOS version

How to add geofencing Reminders to iOS programically

Reference : Calendar and Reminders Programming Guide from iOS Developer Library

Apple provides a way to add a Reminder through EventKit from iOS 6.

1. Before start coding, you should add the EventKit Framework to the target first.

eventkit

2. Check whether iOS is over 6. (Reminder API is available above iOS6)

 

1
2
3
4
// Check API (above iOS6)
if ([[EKEventStore class] instancesRespondToSelector:@selector(requestAccessToEntityType:completion:)] == NO) {
    return nil;
}

3. Init EKEventStore and request access.

5
6
7
8
9
10
11
12
13
EKEventStore *store = [[EKEventStore alloc] init];
 
[store requestAccessToEntityType:EKEntityTypeReminder completion:^(BOOL granted, NSError *error) {
    // handle access here
    if (granted) {
        // Create Reminder... [1]
    }
    [store release];
}];

4. If access is granted, Create reminder and add location alarm. (Code should be inside [1])

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
EKReminder *reminder = [EKReminder reminderWithEventStore:store];
reminder.title = @"Geofence Reminder";
reminder.calendar = [store defaultCalendarForNewReminders]; // Use default calendar for new reminders
 
EKAlarm *alarm = [[EKAlarm alloc] init];
 
EKStructuredLocation *location = [EKStructuredLocation locationWithTitle:@"Location title"];
CLLocation *clLocation = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
location.geoLocation = clLocation;
[clLocation release];
 
[alarm setStructuredLocation:location];
alarm.proximity = EKAlarmProximityEnter; // Remind when enter or leave
[reminder addAlarm:alarm];
[alarm release];
 
// Save reminder
NSError *error;
[store saveReminder:reminder commit:YES error:&error];
if (error != nil) {
    NSLog(@"reminder error:%@",[error description]);
}

Done!