Add contact/friend in skype using api in Java - java

I want to add new contact to a skype account using java with skype api.
Is there any java package available to use for the objective?
Also if there is any sample code available for it please share the link
Thanks in advance

public void sendFriendRequest(String skypeId) throws SkypeException {
Skype.getContactList().addFriend(skypeId, "Confirmation message here, etc! :D");
}
it should be on line 198 on - https://github.com/taksan/skype-java-api/blob/master/src/main/java/com/skype/ContactList.java
Just realize that its a different Skype-API. Sorry.

Related

TwilioRestClient for java not working

I have been trying to use the TwilioRestClient.Builder class in order to send out an sms using my Twilio number.
I have been using this piece of code within a MessageCreator class:
messageCreator = new TwilioMessageCreator(
newTwilioRestClient.Builder(credentials.getAccountSid(),credentials.getAuthToken())
.build()
);
However, when I use this piece of code in another class, I receive this exception:
java.lang.NoClassDefFoundError: org/apache/http/ProtocolVersion com.twilio.http.TwilioRestClient$Builder.<init>(TwilioRestClient.java:66)
This seems to indicate some problem with the TwilioRestClient.Builder() method, but I am unable to identify the issue.
I hope I can get an answer to this!
It is possible you are using version 6.x at the moment, the example of TwilioRestClient.Builder you are looking at is for version 7.x of the java library.
You can check here how you send messages with version 6.x: https://www.twilio.com/docs/api/rest/sending-messages
Please let me know if this helps.

Android Pushwoosh custom data

I done integrating pushwoosh according to pushwoosh guide to my Android app but I need to customize the data comes from the notification. I've paid for custom data and i'm sending a json like this
{"category":"Iraq","id":"1000"}
so when the application get the notification can do an event according to this custom data from pushwoosh.
How to do that ?
Take a look on the Android sample:
https://github.com/Pushwoosh/pushwoosh-sdk-samples/blob/master/Native/Android/src/com/pushwoosh/test/tags/sample/app/MainActivity.java
public void doOnMessageReceive(String message)
JSONObject customJson = new JSONObject(messageJson.getString("u"));
The custom data will be under "u" parameter in the push payload.
Hi Shader the URL you have mentioned is giving 404 . I guess this is the more relevant URL . Please confirm and update your answer
https://github.com/Pushwoosh/pushwoosh-native-samples/tree/master/Android
The sample project was moved to SDK. you can find it here:
https://github.com/Pushwoosh/pushwoosh-android-sdk

Adding campaign in google AdWords

I have a problem during creating the campaign. I have test account on google Adwords. I used code from google: AddCampaigns.java
Im getting error:
[OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED # class campaignmgmt.campaign.MutateAction (ADD) requires CREATE_CAMPAIGN, OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED # class campaignmgmt.campaign.MutateAction (ADD) requires CREATE_CAMPAIGN]
It occurs in line:
// Add campaigns.
CampaignReturnValue result = campaignService.mutate(operations);
I found one problem this type on a google dev webpage, however the 'solution' did not help. Anyone have any idea why is it happening?
Thank you so much and have a nice day!
I solved it setting the clientCustomerId.
With Google AdWords Account you can manage several clients account with several campaigns.
Example of my c# code:
// Get the CampaignService.
CampaignService campaignService =
(CampaignService)_user.GetService(AdWordsService.v201409.CampaignService);
// Set ClientCustomerId
campaignService.RequestHeader.clientCustomerId = myClientCustomerId;

Translating using Google Translate API

I want to use the following code as the basis for a program that translates user input to English. I am getting the error "cannot find symbol - GoogleApi." Can someone please help me figure out what to do?
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
public class Main {
public static void main(String[] args) throws Exception {
// Set the HTTP referrer to your website address.
GoogleAPI.setHttpReferrer(/* Enter the URL of your site here */);
// Set the Google Translate API key
// See: http://code.google.com/apis/language/translate/v2/getting_started.html
GoogleAPI.setKey(/* Enter your API key here */);
String translatedText = Translate.DEFAULT.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);
System.out.println(translatedText);
}
}
what is exactly GoogleApi?
You have not declared that, in order to use it .. I did not understand the program fully, I suggest that you search the website or through google for a program to do that task, there are plenty.
A working code can be found here. It also has link to full codebase on github.
Things to keep in mind:
If you are behind proxy you need make jvm aware of this. One way of doing it is through a static initializer as below:
static
{
System.setProperty("http.proxyHost", HTTP_PROXY_HOST);
System.setProperty("http.proxyPort", HTTP_PROXY_PORT);
System.setProperty("https.proxyHost", HTTPS_PROXY_HOST);
System.setProperty("https.proxyPort", HTTPS_PROXY_PORT);
}
In Run configuration make your GOOGLE_API_KEY available by making it environment variable as below:
For setting up of API key Check section titled "Setting up an API Key".

Dropbox android sdk documentation

I have been doing some research, and for the life of me, I cannot find any documentation on how to use the android dropbox SDK. I have authenticated the user, but now I cannot figure out how the get the metadata (file entries) of a folder. I have looked at the Web docs, but the arguments in java are turned around, flipped over, and then some.
In objective-c, the methods are straight forward, and I understand what is going on. Must I port the code from objective-c to java?
As far as I can tell as of Sep 20, 2011, Dropbox still hasn't put the Android SDK documentation. Here are some workarounds:
This guy created his own version based on the official Dropbox SDK. https://github.com/mlamina/DropboxSDK-for-Android
This forum post gives some tips. In particular, they suggest looking at the Python documentation. http://forums.dropbox.com/topic.php?id=25318
[EDIT by anotheranon user]
My friend stumbled upon this official documentation from Dropbox. Don't even know how he found it. Since this thread is also where I gave up I would like to share!
You should be to find your answer here: https://www.dropbox.com/developers. Looks like the SDK is undocumented.
Try making the calls to the API directly.
In the SDK (DropboxSample), this will list the files in the Public folder of the user account:
In DropboxSample.java add:
public void displayFiles(DropboxAPI.Account account) {
if (account != null) {
DropboxAPI.Entry dbe = api.metadata("dropbox", "/Public", 10000, null, true);
List<Entry> contents = dbe.contents;
if (contents != null) {
for (Entry ent:contents) {
Toast.makeText(this, ent.fileName(), Toast.LENGTH_SHORT).show();
}
}
}
}
In LoginAsyncTask.java add:
mDropboxSample.displayFiles(mAccount);
below mDropboxSample.displayAccountInfo(mAccount);

Categories

Resources