0

Is it possible to make an app that will take a picture from a user's phone's gallery and convert it to a android wearable watch face?

I've been reading up on these Android articles

https://developer.android.com/training/wearables/watch-faces/index.html

https://developer.android.com/training/wearables/watch-faces/drawing.html

and it seems if I can get a user to select a picture from the gallery and convert it to a bitmap it would then be plausible to set that as the watch face. I'm definitely a beginner programmer when it comes to Android and apks. Confirmation from a more advanced Android developer would be great.

Now where I'm getting confused is if the picking of the picture would happen on the user's phone and send it to the android wearable app or if the wearable app has the ability to access the gallery of the user's phone and select it directly. Does anyone know if wearable apps can access the gallery of a users phone?

Assuming I already have a reference of the image selected it would be something like this? Correct me if I'm wrong. (Taken from second article under "Initialize watch face elements"

@Override
public void onCreate(SurfaceHolder holder) {
    super.onCreate(holder);

    // configure the system UI (see next section)
    ...

    // load the background image
    Resources resources = AnalogWatchFaceService.this.getResources();
    //at this point the user should have already picked the picture they want
    //so set "backgroundDrawable" to the image the user picture
    int idOfUserSelectPicture = GetIdOfUserSelectedPictureSomehow();
    Drawable backgroundDrawable = resources.getDrawable(idOfUserSelectPicture, null);
    //original implementation from article
    //Drawable backgroundDrawable = resources.getDrawable(R.drawable.bg, null);
    mBackgroundBitmap = ((BitmapDrawable) backgroundDrawable).getBitmap();

    // create graphic styles
    mHourPaint = new Paint();
    mHourPaint.setARGB(255, 200, 200, 200);
    mHourPaint.setStrokeWidth(5.0f);
    mHourPaint.setAntiAlias(true);
    mHourPaint.setStrokeCap(Paint.Cap.ROUND);
    ...

    // allocate a Calendar to calculate local time using the UTC time and time zone
    mCalendar = Calendar.getInstance();
}

Thank you for any and all help.

Andrea Ebano
  • 563
  • 1
  • 4
  • 16
  • 1
    Your watch app will communicate with your android phone/tablet app via the data layer http://developer.android.com/training/wearables/data-layer/index.html. I would start by doing the picking on the phone/tablet app before trying it on a screen as small as a watch. Good luck. – Morrison Chang Jul 17 '15 at 18:02
  • Thank you, thats a good point picking an image on the watch would be so frustrating with the little amount of screen space available. So definitely the phone app will do the picture selecting and then send that data to the watch app. – atmEthanBehar Jul 17 '15 at 18:17

1 Answers1

0

The way to implement this would be to create a configuration Activity that runs on the phone, that picks from an image on your device. You can then send this image as an Asset via the Data Layer http://developer.android.com/training/wearables/data-layer/index.html and it will be received on the watch side, and you can then make it the background of the watch face.

It is not possible for an Android Wear device to see the photo collection on your phone, they are totally separate devices and nothing is shared by default unless you write an application that does this.

The Data Layer sample shows how to take a photo on the phone, and then send it to the wearable: https://github.com/googlesamples/android-DataLayer

Wayne Piekarski
  • 3,203
  • 18
  • 19