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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Contributor
Posts: 24
Registered: ‎05-03-2013
My Device: Z10
My Carrier: Blackberry
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
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

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
Posts: 24
Registered: ‎05-03-2013
My Device: Z10
My Carrier: Blackberry

Re: Assigning contact image

Thanks for your reply.

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
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 native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 109
Registered: ‎08-23-2012
My Device: Blackberry Z10
My Carrier: TATA DOCOMO

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
Posts: 24
Registered: ‎05-03-2013
My Device: Z10
My Carrier: Blackberry

Re: Assigning contact image

Thanks a lot it worked for me.