0

I'm attempting to send notifications to Sony LiveWare devices

I've installed: com.sonyericsson.extras.liveware.extension.notificationsample, but I get errors and exceptions while trying to run it:

  1. Load the preference activity onto the device
  2. Check "Active" on the preferences screen

The following method is called in SampleExtensionService:

private void addData() {
    Random rand = new Random();
    int index = rand.nextInt(5);
    String name = NAMES[index];
    String message = MESSAGE[index];
    long time = System.currentTimeMillis();
    long sourceId = NotificationUtil
            .getSourceId(this, EXTENSION_SPECIFIC_ID);
    if (sourceId == NotificationUtil.INVALID_ID) {
        Log.e(LOG_TAG, "Failed to insert data");
        return;
    }
    String profileImage = ExtensionUtils.getUriString(this,
            R.drawable.widget_default_userpic_bg);

    ContentValues eventValues = new ContentValues();
    eventValues.put(Notification.EventColumns.EVENT_READ_STATUS, false);
    eventValues.put(Notification.EventColumns.DISPLAY_NAME, name);
    eventValues.put(Notification.EventColumns.MESSAGE, message);
    eventValues.put(Notification.EventColumns.PERSONAL, 1);
    eventValues.put(Notification.EventColumns.PROFILE_IMAGE_URI, profileImage);
    eventValues.put(Notification.EventColumns.PUBLISHED_TIME, time);
    eventValues.put(Notification.EventColumns.SOURCE_ID, sourceId);

    try {
        getContentResolver().insert(Notification.Event.URI, eventValues);
    } catch (IllegalArgumentException e) {
        Log.e(LOG_TAG, "Failed to insert event", e);
    } catch (SecurityException e) {
        Log.e(LOG_TAG, "Failed to insert event, is Live Ware Manager installed?", e);
    } catch (SQLException e) {
        Log.e(LOG_TAG, "Failed to insert event", e);
    }
}

The first problem is that "long sourceId = NotificationUtil.getSourceId(this, EXTENSION_SPECIFIC_ID)" returns -1

I'm not sure how to change, but the docs say it is an optional field. So I removed it to see if I could get any further:

When removing the sourceId code I get an exception on the insert call: "java.lang.SecurityException: You do not have sufficient permission to perform a insert"

My Environment: HTC One V paired with a LiveView wrist pager http://www.amazon.co.uk/Sony-Ericsson-0001516170-LIVE-VIEW/dp/B00477X6DA I've got the followings apps installed LiveView SmartConnect(LiveWare Manager)

I'd appreciate any help getting this sample to work or if anyone knows of a more straight forward approach to doing simple text notifications for LiveWare.

EDIT: Made some progress. Found an emulator here: android-sdk\add-ons\addon-sony_add-on_sdk_1_0-sony-16\apk_files

I installed that on the phone. The "SampleExtensionService" works fine in the emulator.

My assumption now is that add-on sample is not compatible with the LiveView device.

  • Does a LiveView count as a SmartWatch? – weston Oct 05 '13 at 09:35
  • I tagged it as SmartWatch because I don't have enough "points" to tag it as LiveWare. My understanding is that both Sony SmartWatch and LiveView Pager both use LiveWare. I had assumed that if I could send notification to a LiveView device that would also work for Sony SmartWatch. In any event, the sample doesn't work with the LiveView device. – user2848329 Oct 05 '13 at 10:36

1 Answers1

3

The LiveView is unfortunately not supported by the SmartExtension APIs. Instead, there is a specific developer kit for the LiveView here.

If you would, in the future, buy a newer wearable device from Sony Mobile, a notification extension based on the Smart Extension APIs would be usable for several devices including SmartWatch, SmartWatch 2, SBH50, SBH52 etc.

Jerker
  • 805
  • 4
  • 9