Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
aadi007
Posts: 24
Registered: ‎05-03-2013
My Device: Z10
Accepted Solution

Assigning contact image

Hello,

          I am trying to assign image to contact, But facing problem in getting it done. I am using the API contactservice.setprimaryphoto(Contactid,ContactPhotoid). I have created a contactPhoto object using 

ContactPhoto photo = ContactPhotoBuilder()
                     .setOriginalPhoto("/images/photos/myPhoto1.png");
 

myImage.png is the image file in temporary directory. when i execute the logs shows 

 

*   Trying 127.0.0.1...

* TCP_NODELAY set

* Local Interface lo0 is ip 127.0.0.1 using address family 2

* Local port: 0

* connected

* Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)

> PUT /contact/4/13/photos/primary HTTP/1.1

Host: 127.0.0.1:8888

Accept: */*

Content-Type: application/x-www-form-urlencoded

pim-session: df1f85e3-da12-400a-b56b-a60880d6d5ed

api-version: 1.0

User-Agent: com.company.bb10.myAPP.testDev__myapp52b200ec

Content-Length: 35

 

* We are completely uploaded and fine

 HTTP/1.1 200 OK

 Content-Length: 8

 Content-Type: application/json

 Date: Fri, 21 Jun 2013 05:01:13 GMT

Server: BLACKBERRY-57DF

* Closing connection #0

 

every thing seems to be fine but photo is not assigned to the contact. Could any one help me ? Thanks in advance.

Retired
PBernhardt
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30

Re: Assigning contact image

Please log a bug in our Developer Issue Tracker:

DIT

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Contributor
aadi007
Posts: 24
Registered: ‎05-03-2013
My Device: Z10

Re: Assigning contact image

Thanks for your reply.

Developer
ekke
Posts: 1,571
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Assigning contact image


aadi007 wrote:

Hello,

          I am trying to assign image to contact, But facing problem in getting it done. I am using the API contactservice.setprimaryphoto(Contactid,ContactPhotoid). I have created a contactPhoto object using 

ContactPhoto photo = ContactPhotoBuilder()
                     .setOriginalPhoto("/images/photos/myPhoto1.png");
 

myImage.png is the image file in temporary directory. when i execute the logs shows 

 


THIS is your problem: adding an Image from tmp folder or any folder inside your sandbox or from assets doesn't work !

 

place your Image inside /shared/camera  or so and it will work without problems

 

if your images are stored in sandbox you have to

1. copy to shared

2. add to contact

3. delete from shared

 

don'tr forget permissions for shared

and it's a good idea to describe your users why you need write access to shared

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
sorout2009
Posts: 105
Registered: ‎08-23-2012
My Device: Blackberry Z10

Re: Assigning contact image

Hi

 

If you are taking the image from your app folder i.e. may be from asset or app shared folder, it will be accessible in your app only. Thats why not permit to assign as a contact image. For that you have to write the image in device memory like in camera folder then using this new path you can assign image to a contact.

Dharmender Singh
Contributor
aadi007
Posts: 24
Registered: ‎05-03-2013
My Device: Z10

Re: Assigning contact image

Thanks a lot it worked for me.