public final class

SCCoreFacade

extends Object
java.lang.Object
   ↳ com.c2call.sdk.pub.facade.SCCoreFacade

Class Overview

This singleton handles the low-level communication to the C2Call service

Summary

Public Methods
boolean addBrainTreeCredit(int value, SCCurrency currency, String nonce)
Add user credit through the Braintree API (www.braintreepayments.com, https://developers.braintreepayments.com/android+php/sdk/client/drop-in)
boolean addCredit(int valueInCent, SCCurrency currency, String transactionId, String receipt)
Ads credit the specified recipient.
boolean addCreditGooglePlay(int valueInCent, SCCurrency currency, String sku, String serviceEmail, String orderid, String receipt, String prvkey)
Adds user credit though the Google Play in-app billing API (http://developer.android.com/google/play/billing/billing_overview.html)
final void addEventListener(SCEventListenerFacade listener)
Adds a listener for all C2Call events handled by this facade class.
boolean addFriend(String friend)
Adds a friend to the user's friend list.
boolean addFriends(List<String> emails)
Addss multiple friends to the user's friend list.
void addServiceConnectionListener(IServiceListener listener)
Add a listeser that gets notified when the C2Call background service is connected.
int autoLoginIfPossible(Context ctx, boolean syncData)
Same as autoLoginIfPossible(Context, boolean, boolean) with 'force' parameter 'true'
int autoLoginIfPossible(Context ctx, boolean syncData, boolean force)
Perform a login based on stored credentials, if any.
boolean call(String to, boolean isVideo, boolean isGroup)
Try to accomplish a call to the given destination.
boolean call(String to, String callerid, boolean isVideo, boolean isGroup)
boolean changePassword(String newPassword)
Changes the psasword of the currently logged in user
boolean checkExistingUser(String email)
Checks if a user is already registered.
String convertToE164(String number, String defaultCountryCode)
Converts a phone number to E.164 format
String createGroup(String name, Collection<String> members, Set<SCFriendGroup.UserData> userData)
Creates a new group.
String createGroup(String name, Collection<String> members)
Creates a new group.
String createGroupLink(String groupid)
int deleteCalls(List<String> ids)
Deletes given calls from the call history
boolean deleteFriend(String userid)
Deletes a friendship relation.
boolean deleteGroup(String userid)
Deletes a group.
int deleteMessages(List<String> ids)
Deletes given messages from the message history
static void enableStartStopServices(boolean enabled)
Enables or disables the the automatic starting and stopping of internal services when switching from foreground to background.
List<SCGroupCall> getActiveGroupCalls()
Get a list of active group calls.
SCCredentials getAutoLoginCredentials()
Gets the credentials of the currently logged in user.
String getBrainTreeToken()
Retrieves the client token that is passed to the BraintreePaymentActivity, BraintreePaymentActivity.EXTRA_CLIENT_TOKEN
SCCallStatus getCallStatus()
Returns the last call status
SCCountry getCountry(Context context, int countryCode)
Get a SCCountry object of the given country code
SCCountry getCountry(Context context, String e164)
Get a SCCountry object of the given phone number in E164 format
SCCredit getCredit()
Gets the current credit of the logged in user.
SCCountry getDefaultCountry(Context context)
Get the default country of the user.
String getDefaultCountryCode()
String getEmailForAutoLogin()
@return
static SCFriendData getFriendByEmail(String email)
Gets a friend by the speified email.
SCFriendGroup getFriendGroup(String userid)
Returns a complete SCFriendGroup object based on the group's userid.
SCGroupCall getGroupCallInfo(String id)
Get info of a running group call with the given id.
String getInterlocutor()
Returns tha last call interlocutor.
SCCredentials getNumberRegCredentials(Context ctx, String number)
Get the credentials that must be used to login when the useres registered with his phone number.
SCOnlineStatus getOnlineStatus(String userid, SCOnlineStatus def)
Gets the online status of the given userid.
String getPasswordForAutoLogin()
@return
SCPhoneNumberLocation getPhoneNumberLocation(String phonenumber)
Gets the location (Country and Area) of the given phone number (must be in E.164 format).
SCMoneyAmount getPriceInfo(String number, SCCurrency currency, boolean isVat, boolean isSms)
Get the price info for a given number an currency.
SCProfile getProfile()
Gets the currently logged in SCProfile object.
String getSessonKey()
Get the current C2Call session key for the logged in user
SCFriendData getUserInfo(String userid)
Get the public data for an arbitrary userid.
void hangup()
Terminates a running call.
static SCCoreFacade instance()
void invalidateSession()
boolean isAutoLoginPossible()
Checks if automatic login is possible.
boolean isCallRunning()
Checks if there is an active call
boolean isConnectedToService()
Checks whether the C2Call service is correctly connected
boolean isFriendGroup(String userid)
Checks if the given userid belongs to a group
static boolean isOnline()
boolean isSessionValid()
Checks whether the current session is still valid
static boolean isSipConnectionActive()
boolean isVisible()
int joinGroup(String groupid)
Join to the given public group.
int login(String username, String password, boolean rememberPassword)
Login with the given username and password.
int login(String username, String password)
Login with the given username and password.
int loginWithSessionId(String sessionid)
int loginWithToken(String token)
boolean logout()
Logout, stops every running thread and cleans up some temporary resources.
void postEvent(Object evt, boolean isSticky)
Post an event to the event bus.
int recallMessage(String mid, String remoteUser)
Recalles the message with the given id.
boolean redeemVoucher(String voucherCode)
Redeem a C2Call voucher to add user credit
boolean refreshAffiliateData()
Forces a refresh of your affilitate data which contains feature permissions, applictaiton settings as defined in the C2Call DevArea
int registerNewUser(SCRegistrationData registrationData)
Registers a new user.
void removeEventListener(SCEventListenerFacade listener)
Removes an attached listener
boolean removeServiceConnectionListener(IServiceListener listener)
Remove a listener that was previously added by addServiceConnectionListener(IServiceListener)
int sendAudioMessage(String to, String text, String path)
Sends an audio message to the given recipient
int sendAudioMessage(String to, String xcallerid, String text, String path)
boolean sendCallmeMessage(String userid)
boolean sendDTMF(SCDtmfButtonType tone)
Sends a DTMF tone to the calling partner.
boolean sendEncrpytedMessage(Context ctx, String to, String xcallerid, String message, String keyBase64)
Sends an encrpyted message to the given user.
boolean sendEvent(String userid, String eventName, String message)
An Event Message is supposed to be an internal notification from app to app to submit status information or other information which shouldn't be displayed to the user directly.
int sendImageMessage(String to, String xcallerid, String text, String path)
int sendImageMessage(String to, String text, String path)
Sends a image message to the given recipient
boolean sendLocationMessage(String to, String xcallerid, String text, Location location, Address address)
boolean sendLocationMessage(String to, String text, Location location, Address address)
Sends a image message to the given recipient
boolean sendMessage(String to, String xcallerid, String message)
boolean sendMessage(String to, String message)
Sends a message to the given recipient
boolean sendObject(String to, String text, SCBaseRichMessageSendObject sendObject, String publicKey)
Sends an instance of SCBaseRichMessageSendObject and an optional text to the giver recipient
boolean sendObject(String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject, String publicKey, boolean threaded)
boolean sendObject(String to, String text, SCBaseRichMessageSendObject sendObject)
boolean sendObject(String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject, String publicKey)
boolean sendObject(String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject, boolean threaded)
boolean sendObject(String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject)
boolean sendReadReport(SCBoardEventData message, boolean threaded)
Send a read report to for the specified borad message, which essentially sets the status of that message
int sendVideoMessage(String to, String text, String path)
Sends a video message to the given recipient
int sendVideoMessage(String to, String xcallerid, String text, String path)
void setAdvertisingIdProvider(IAdvertisingIdProvider provider)
void setDefaultCountryCode(String code)
Sets the default country code that is used whenever a phone number is converted that is not in E.164 format
void setEnableOfferWall(boolean enable)
Enables the offerwall feature.
void setSupportedCodecs(CodecType[] codecs)
Set a list of codecs that should be supported.
void setVisible(Class<Activity> c, boolean visible)
void startServices(Context context)
Call this to start internal services that are needed to keep the session alive
void stopServices(Context context)
Call this to stop internal services
void subscribe(Object listener, int priority)
Register an event listener to receive application events.
void subscribe(Object listener)
Same as subscribe(Object, int) with priority 0.
boolean takeCall(boolean asVideo)
Takes an incoming call.
void unsubscribe(Object listener)
Unsubscribes a listener.
boolean updateBoard()
Fires an asynchronous request to update the board (message- and call history).
boolean updateCredit()
Fires an asynchronous request to update the user credit.
boolean updateFriendGroup(SCFriendGroup group)
Updates a group.
boolean updateFriendList()
Fires an asynchronous request to update the friend list.
void updateProfile()
Fires an asynchronous request to update the user's profile.
boolean updateProfile(SCProfile profile)
Update the currently logged in user.
boolean uploadUserImage(String imagePath)
Uploads an image for the currently logged in user
boolean wakeupAndConnect(Context context, boolean force, boolean fullWakeLock, int wakeLockTimoutMs)
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean addBrainTreeCredit (int value, SCCurrency currency, String nonce)

Add user credit through the Braintree API (www.braintreepayments.com, https://developers.braintreepayments.com/android+php/sdk/client/drop-in)

Parameters
value the credit amount int Cents
currency the currency of the credit
nonce secret token as given by the Braintree API
Returns
  • true on succes.

public boolean addCredit (int valueInCent, SCCurrency currency, String transactionId, String receipt)

Ads credit the specified recipient.

Returns
  • true, on success.

public boolean addCreditGooglePlay (int valueInCent, SCCurrency currency, String sku, String serviceEmail, String orderid, String receipt, String prvkey)

Adds user credit though the Google Play in-app billing API (http://developer.android.com/google/play/billing/billing_overview.html)

Parameters
valueInCent the value in cents to add
currency the currency of the credit
sku the Google Play SKU (product) of this transfer as specified in your Google Developer Conosle for the app
serviceEmail the OAuth service email as specified in your Google API Console (https://code.google.com/apis/console) APIs & auth -> Credentials -> Create new Client ID -> Service Account
orderid the ordeer id of the purchase
receipt the unique token of the purchase
prvkey the base64 encoded private keyprivate key from your Google API console: APIs & auth -> Credentials -> Create new Client ID -> Service Account -> Generate new P12 key
Returns
  • true on success

public final void addEventListener (SCEventListenerFacade listener)

Adds a listener for all C2Call events handled by this facade class. The listener will be stored as a strong static reference. It is up to the caller to remove the listener at a proper location to avoid memory leaks.

Parameters
listener the listener to add. Must not be null.
Throws
IllegalStateException if listener is null.
IllegalArgumentException

public boolean addFriend (String friend)

Adds a friend to the user's friend list.

Parameters
friend the friend's email address or phone number to add.
Returns
  • true, if success

public boolean addFriends (List<String> emails)

Addss multiple friends to the user's friend list.

Parameters
emails the emails or phone numbers to add.
Returns
  • true, if success

public void addServiceConnectionListener (IServiceListener listener)

Add a listeser that gets notified when the C2Call background service is connected. Most other SDK methods will fail before that is the case. Note that the caller is responsible for removing the listener if it is no longer needed (to avoid memory leaks).

Parameters
listener the listener to add

public int autoLoginIfPossible (Context ctx, boolean syncData)

Same as autoLoginIfPossible(Context, boolean, boolean) with 'force' parameter 'true'

public int autoLoginIfPossible (Context ctx, boolean syncData, boolean force)

Perform a login based on stored credentials, if any.

Parameters
syncData set this to 'true' if you want to automatically synchronize the user data (friends, board, etc.) after a successful login
force if true, then any active session will be invalidated before re-login.
Returns
  • 0 on success.

public boolean call (String to, boolean isVideo, boolean isGroup)

Try to accomplish a call to the given destination.

Parameters
to the destination of the desired call. May be either a valid phonenumber (E.164 format) or the userId of another user. Must not be null or empty.
isVideo whether this is a video call
isGroup whether this is a group call
Returns
  • true if call invite was successfully sent, false otherwise
Throws
IllegalStateException if to is null or empty.
IllegalArgumentException

public boolean call (String to, String callerid, boolean isVideo, boolean isGroup)

Throws
IllegalArgumentException

public boolean changePassword (String newPassword)

Changes the psasword of the currently logged in user

Parameters
newPassword the new password
Returns
  • true, on success, false otherwise

public boolean checkExistingUser (String email)

Checks if a user is already registered. Must not be called on the main-thread.

Parameters
email the email to check.
Returns
  • true, if the user is already registered to the service, false otherwise.

public String convertToE164 (String number, String defaultCountryCode)

Converts a phone number to E.164 format

Parameters
number the number to convert
defaultCountryCode the default country code, that is used if the number does not include one.
Returns
  • the converted E.164 number

public String createGroup (String name, Collection<String> members, Set<SCFriendGroup.UserData> userData)

Creates a new group.

Parameters
name the group name.
members the group members.
userData optional custom user data for this group
Returns
  • the userid of the created group or null if an error occured

public String createGroup (String name, Collection<String> members)

Creates a new group.

Parameters
name the group name.
members the group members.
Returns
  • the userid of the created group or null if an error occured

public String createGroupLink (String groupid)

public int deleteCalls (List<String> ids)

Deletes given calls from the call history

Parameters
ids a List of IDs to delete. As given by getId()
Returns
  • 0 on success

public boolean deleteFriend (String userid)

Deletes a friendship relation.

Parameters
userid the userid of the friend to delete
Returns
  • true on success

public boolean deleteGroup (String userid)

Deletes a group. Note that you must be the owner of the group in order to be able to delete it.

Parameters
userid the userid of the group to delete
Returns
  • true on success

public int deleteMessages (List<String> ids)

Deletes given messages from the message history

Parameters
ids a List of IDs to delete. As given by getId()
Returns
  • 0 on success

public static void enableStartStopServices (boolean enabled)

Enables or disables the the automatic starting and stopping of internal services when switching from foreground to background. If this is disabled then you have to manually call startServices(Context) and stopServices(Context) during your activity lifecycles where needed.

public List<SCGroupCall> getActiveGroupCalls ()

Get a list of active group calls.

Returns
  • a list of active group calls.

public SCCredentials getAutoLoginCredentials ()

Gets the credentials of the currently logged in user. This may be used for auto-login sequences

Returns
  • the login credentials of the currently logged in user.

public String getBrainTreeToken ()

Retrieves the client token that is passed to the BraintreePaymentActivity, BraintreePaymentActivity.EXTRA_CLIENT_TOKEN

Returns
  • the Braintree client token

public SCCallStatus getCallStatus ()

Returns the last call status

Returns
  • that last call status

public SCCountry getCountry (Context context, int countryCode)

Get a SCCountry object of the given country code

Returns
  • the country of the given country code

public SCCountry getCountry (Context context, String e164)

Get a SCCountry object of the given phone number in E164 format

Parameters
e164 phone number in E164 format
Returns
  • the country of the given phone number

public SCCredit getCredit ()

Gets the current credit of the logged in user.

Returns
  • the current credit

public SCCountry getDefaultCountry (Context context)

Get the default country of the user. Note the this is only a guess based on recent GPS evnts, ip address, telephony services, devices locale settings, etc....

public String getDefaultCountryCode ()

public String getEmailForAutoLogin ()

@return

public static SCFriendData getFriendByEmail (String email)

Gets a friend by the speified email.

Parameters
email the email of the friend.
Returns
  • the friend with matching email address, or null if no such email was found.

public SCFriendGroup getFriendGroup (String userid)

Returns a complete SCFriendGroup object based on the group's userid. This method must not be called on the main-thread

Parameters
userid the userid of the group
Returns
  • SCFriendGroup object if userid is a valid id of a group, null otherwise

public SCGroupCall getGroupCallInfo (String id)

Get info of a running group call with the given id.

Parameters
id the id of the group call.
Returns
  • the info object of the active group call, or null if no active group call with given id was found.

public String getInterlocutor ()

Returns tha last call interlocutor.

Returns
  • the last call interlocutor

public SCCredentials getNumberRegCredentials (Context ctx, String number)

Get the credentials that must be used to login when the useres registered with his phone number.

Parameters
number the previously verified number
Returns
  • the credentials to login.

public SCOnlineStatus getOnlineStatus (String userid, SCOnlineStatus def)

Gets the online status of the given userid.

Parameters
userid the userid
def default online status that is returned if to status inforamtion is found for the given user. May be null.
Returns
  • the online stataus of a given user, or the default value def, if the user was not found.

public String getPasswordForAutoLogin ()

@return

public SCPhoneNumberLocation getPhoneNumberLocation (String phonenumber)

Gets the location (Country and Area) of the given phone number (must be in E.164 format).

Parameters
phonenumber the number to get the location for.
Returns
  • the location of the given number.

public SCMoneyAmount getPriceInfo (String number, SCCurrency currency, boolean isVat, boolean isSms)

Get the price info for a given number an currency. Must not be called on the main-thread.

Parameters
number the number to check
currency the currency of the returned price info
isVat whether VAT should be respected.
isSms set this to 'true' to get the price for a SMS and 'false' for a regular call.
Returns
  • the price info object.

public SCProfile getProfile ()

Gets the currently logged in SCProfile object.

Returns
  • the logged in protile object, or null if no user is currently logged in

public String getSessonKey ()

Get the current C2Call session key for the logged in user

Returns
  • the C2Call session key

public SCFriendData getUserInfo (String userid)

Get the public data for an arbitrary userid. This user doesn't need to be a friend of the current user.

public void hangup ()

Terminates a running call. You may also call this method to decline an incoming call.

Throws
IllegalStateException if this method is called when no call is running.

public static SCCoreFacade instance ()

public void invalidateSession ()

public boolean isAutoLoginPossible ()

Checks if automatic login is possible. This is the case if all need user credentials are locally stored.

Returns
  • true if auto login is possible.

public boolean isCallRunning ()

Checks if there is an active call

Returns
  • whether an active call is running.

public boolean isConnectedToService ()

Checks whether the C2Call service is correctly connected

Returns
  • true, if the service is correctly connected.

public boolean isFriendGroup (String userid)

Checks if the given userid belongs to a group

Parameters
userid the userid to check
Returns
  • true if the given userid is not null and belongs to a group, false otherwise

public static boolean isOnline ()

Returns
  • true if this client is currenty online and connected to the C2Call server, false otherwise

public boolean isSessionValid ()

Checks whether the current session is still valid

Returns
  • true, if session is valid

public static boolean isSipConnectionActive ()

public boolean isVisible ()

public int joinGroup (String groupid)

Join to the given public group. A group is 'public' if it has the the SCFriendGroup.UserData 'C2GROUP_ATTR_PUBLIC' set to true.

Parameters
groupid the ID of the group to join
Returns
  • 0 on success

public int login (String username, String password, boolean rememberPassword)

Login with the given username and password.

Parameters
username The username to login. Must not be null or empty.
password The Password to login. Must not be null or empty.
rememberPassword Set this true if you want to internally save the login data. This is needed if you want your App to automatically login on certain events, like an incoming call notification via GCM.
Returns
  • resulting login error.
Throws
IllegalArgumentException if username or password is null or empty.

public int login (String username, String password)

Login with the given username and password.

Parameters
username The username to login. Must not be null or empty.
password The Password to login. Must not be null or empty.
Returns
  • resulting login error.
Throws
IllegalArgumentException if username or password is null or empty.

public int loginWithSessionId (String sessionid)

public int loginWithToken (String token)

public boolean logout ()

Logout, stops every running thread and cleans up some temporary resources.

public void postEvent (Object evt, boolean isSticky)

Post an event to the event bus. This event will be received by every listener subscribed with subscribe(Object, int)

Parameters
evt the event to post.
isSticky if true then this event will be sticky. This means that every subsriber Method that sets the annotation attribute SCEventCallback#isSticky() to true will immediatly receive the last posted sticky event after subscription.

public int recallMessage (String mid, String remoteUser)

Recalles the message with the given id. To use this feature the application must set the string resource R.string.sc_enable_message_recall to "true"

Parameters
mid the message id
remoteUser the original receiver's userid of the message

public boolean redeemVoucher (String voucherCode)

Redeem a C2Call voucher to add user credit

Parameters
voucherCode the voucher code to redeem
Returns
  • true on success

public boolean refreshAffiliateData ()

Forces a refresh of your affilitate data which contains feature permissions, applictaiton settings as defined in the C2Call DevArea

public int registerNewUser (SCRegistrationData registrationData)

Registers a new user.

Parameters
registrationData the registration data.
Returns
  • 0, on success

public void removeEventListener (SCEventListenerFacade listener)

Removes an attached listener

Parameters
listener the listener to remove. Must not be null.
Throws
IllegalStateException if listener is null.
IllegalArgumentException

public boolean removeServiceConnectionListener (IServiceListener listener)

Remove a listener that was previously added by addServiceConnectionListener(IServiceListener)

Returns
  • true if the lsitener was removed

public int sendAudioMessage (String to, String text, String path)

Sends an audio message to the given recipient

Parameters
to Recipient of the message. Must not be null or empty.
text If not null, then this text will be attached to the video message
path Full path to the media file to be sent. Must not be null or empty.
Returns
  • Error code, or 0 on success

public int sendAudioMessage (String to, String xcallerid, String text, String path)

public boolean sendCallmeMessage (String userid)

public boolean sendDTMF (SCDtmfButtonType tone)

Sends a DTMF tone to the calling partner. Only usable during PSTN calls.

Parameters
tone the tone to send.
Returns
  • true on success.

public boolean sendEncrpytedMessage (Context ctx, String to, String xcallerid, String message, String keyBase64)

Sends an encrpyted message to the given user.

Parameters
ctx the context to use
to the receiver of the message
xcallerid an optional CallId for the message (may be null)
message the plain message to send
keyBase64 a Base64 encoded public key which is used to encrypt the message before sending
Returns
  • true on successe

public boolean sendEvent (String userid, String eventName, String message)

An Event Message is supposed to be an internal notification from app to app to submit status information or other information which shouldn't be displayed to the user directly. Every event name has to start with prefix "SCEVNT_" otherwise it will not be handled

Parameters
userid the receiver of the event.
eventName the event name, SCEVNT_ plus just 7 Bit ASCII characters no blanks
message optional message, may be null.
Returns
  • true if message was successfully send

public int sendImageMessage (String to, String xcallerid, String text, String path)

public int sendImageMessage (String to, String text, String path)

Sends a image message to the given recipient

Parameters
to Recipient of the message. Must not be null or empty.
text If not null, then this text will be attached to the video message
path Full path to the media file to be sent. Must not be null or empty.
Returns
  • Error code, or 0 on success

public boolean sendLocationMessage (String to, String xcallerid, String text, Location location, Address address)

public boolean sendLocationMessage (String to, String text, Location location, Address address)

Sends a image message to the given recipient

Parameters
to Recipient of the message. Must not be null or empty.
text If not null, then this text will be attached to the location message
location The location to be sent. Must not be null.
address The address to be sent
Returns
  • True on success, false otherwise

public boolean sendMessage (String to, String xcallerid, String message)

public boolean sendMessage (String to, String message)

Sends a message to the given recipient

Parameters
to Recipient of the message
message Message to be send
Returns
  • true If the message was successfully sent, false otherwise

public boolean sendObject (String to, String text, SCBaseRichMessageSendObject sendObject, String publicKey)

Sends an instance of SCBaseRichMessageSendObject and an optional text to the giver recipient

Parameters
to Recipient of the message. Must not be null or empty.
text If not null, then this text will be attached to object
sendObject the SCBaseRichMessageSendObject to be send
publicKey optional public key in Base64 format to encrypt the message
Returns
  • True on success, false otherwise

public boolean sendObject (String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject, String publicKey, boolean threaded)

public boolean sendObject (String to, String text, SCBaseRichMessageSendObject sendObject)

public boolean sendObject (String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject, String publicKey)

public boolean sendObject (String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject, boolean threaded)

public boolean sendObject (String to, String xcallerid, String text, SCBaseRichMessageSendObject sendObject)

public boolean sendReadReport (SCBoardEventData message, boolean threaded)

Send a read report to for the specified borad message, which essentially sets the status of that message

Parameters
message the message to send a read report for. Note: Only getId() and getUserid() is used so this may be a dummy object with just those values set.
threaded if true then the read report will be queued in an ExecutorService to be transmitted asynchronously
Returns
  • if threaded is true then this method always returns true, otherwise it returns whether the read report was successfully sent.

public int sendVideoMessage (String to, String text, String path)

Sends a video message to the given recipient

Parameters
to Recipient of the message. Must not be null or empty.
text If not null, then this text will be attached to the video message
path Full path to the media file to be sent. Must not be null or empty.
Returns
  • Error code, or 0 on success

public int sendVideoMessage (String to, String xcallerid, String text, String path)

public void setAdvertisingIdProvider (IAdvertisingIdProvider provider)

public void setDefaultCountryCode (String code)

Sets the default country code that is used whenever a phone number is converted that is not in E.164 format

public void setEnableOfferWall (boolean enable)

Enables the offerwall feature. By default this is disabled to save resources

public void setSupportedCodecs (CodecType[] codecs)

Set a list of codecs that should be supported. Note that some codecs are quite complex and won't run in realtime on weak devices.

Parameters
codecs an array of supported codecs in ascending priority order (lower index means higher priority). Possible supported codecs may be any of uLaw, aLaw, GSM, Speex, iLBC, G.723.1. In order to support dtmf tones, the special "codec" TelephoneEvent must be included into this list, too.
Default is [CodecType.Speex, CodecType.GSM610, CodecType.ULaw, CodecType.ALaw, CodecType.TelephoneEvent]

public void setVisible (Class<Activity> c, boolean visible)

public void startServices (Context context)

Call this to start internal services that are needed to keep the session alive

public void stopServices (Context context)

Call this to stop internal services

public void subscribe (Object listener, int priority)

Register an event listener to receive application events. To receive a event the listener must define a method annotated with SCEventCallback that has a single parameter of the event's type. E.g:

 public class MyListner
 {
     @SCEventCallback
     public void myOnIncomingCall(SCIncomingCallEvent evt)
     {
         // handle incoming calls
     }

     @SCEventCallback
     public void myOnPresence(SCPresenceEvent evt)
     {
         // handle presence status updates of your friends
     }
 }
 
Note: In order to avoid memory leaks, the caller is responsible to unsubscribe the listener when no longer needed.

Parameters
listener the object to receive events.
priority object subscribed with higher priority will receive events earlier.

public void subscribe (Object listener)

Same as subscribe(Object, int) with priority 0.

public boolean takeCall (boolean asVideo)

Takes an incoming call.

Parameters
asVideo if true, then this call will be taken as video
Throws
IllegalStateException if this method is called when no incoming call is waiting.

public void unsubscribe (Object listener)

Unsubscribes a listener. The given object will no longer receive application events.

Parameters
listener the listener to unsubscribe.

public boolean updateBoard ()

Fires an asynchronous request to update the board (message- and call history). Override the method onUpdateBoard(List) of SCEventListenerFacade to catch the new friend list.

Returns
  • true, on success

public boolean updateCredit ()

Fires an asynchronous request to update the user credit. Override the method onCreditChanged(com.c2call.sdk.pub.common.SCCredit) of SCEventListenerFacade to catch the new credit.

Returns
  • true, on success

public boolean updateFriendGroup (SCFriendGroup group)

Updates a group.

Parameters
group the group to update. Must not be null.
Returns
  • true on success, false otherwise.

public boolean updateFriendList ()

Fires an asynchronous request to update the friend list. Override the method onUpdateFriends(java.util.List) of SCEventListenerFacade to catch the new friend list.

Returns
  • true, on success

public void updateProfile ()

Fires an asynchronous request to update the user's profile. Override the method onProfileUpdate(SCProfile) )} of SCEventListenerFacade to catch the new profile.

Returns
  • true, on success

public boolean updateProfile (SCProfile profile)

Update the currently logged in user. Must not be called on the main-thread.

Parameters
profile the new user data
Returns
  • true, on success, false otherwise

public boolean uploadUserImage (String imagePath)

Uploads an image for the currently logged in user

Parameters
imagePath the absolute path to the image to upload
Returns
  • true on success
Throws
FileNotFoundException if the given file does not exist.

public boolean wakeupAndConnect (Context context, boolean force, boolean fullWakeLock, int wakeLockTimoutMs)