本文整理汇总了Java中com.soomla.SoomlaUtils.LogWarning方法的典型用法代码示例。如果您正苦于以下问题:Java SoomlaUtils.LogWarning方法的具体用法?Java SoomlaUtils.LogWarning怎么用?Java SoomlaUtils.LogWarning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.soomla.SoomlaUtils
的用法示例。
在下文中一共展示了SoomlaUtils.LogWarning方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SequenceReward
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
* Constructor.
* Generates an instance of <code>SequenceReward</code> from the given <code>JSONObject</code>.
*
* @param jsonObject A JSONObject representation of the wanted <code>SequenceReward</code>.
* @throws JSONException
*/
public SequenceReward(JSONObject jsonObject) throws JSONException {
super(jsonObject);
mRewards = new ArrayList<Reward>();
JSONArray rewardsArr = jsonObject.optJSONArray(com.soomla.data.JSONConsts.SOOM_REWARDS);
if (rewardsArr == null) {
SoomlaUtils.LogWarning(TAG, "reward has no meaning without children");
rewardsArr = new JSONArray();
}
for(int i=0; i<rewardsArr.length(); i++) {
JSONObject rewardJSON = rewardsArr.getJSONObject(i);
Reward reward = fromJSONObject(rewardJSON);
if (reward != null) {
mRewards.add(reward);
}
}
}
示例2: RandomReward
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
* Constructor.
* Generates an instance of <code>RandomReward</code> from the given <code>JSONObject</code>.
*
* @param jsonObject A JSONObject representation of the wanted <code>RandomReward</code>.
* @throws JSONException
*/
public RandomReward(JSONObject jsonObject) throws JSONException {
super(jsonObject);
mRewards = new ArrayList<Reward>();
JSONArray rewardsArr = jsonObject.optJSONArray(com.soomla.data.JSONConsts.SOOM_REWARDS);
if (rewardsArr == null) {
SoomlaUtils.LogWarning(TAG, "reward has no meaning without children");
rewardsArr = new JSONArray();
}
// Iterate over all rewards in the JSON array and for each one create
// an instance according to the reward type
for (int i = 0; i < rewardsArr.length(); i++) {
JSONObject rewardJSON = rewardsArr.getJSONObject(i);
Reward reward = Reward.fromJSONObject(rewardJSON);
if (reward != null) {
mRewards.add(reward);
}
}
}
示例3: ProviderManager
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
public ProviderManager(Map<IProvider.Provider, ? extends Map<String, String>> profileParams, String... providerNames) {
List<Class<? extends IProvider>> providerClass = tryFetchProviders(providerNames);
if (providerClass == null || providerClass.size() == 0) {
SoomlaUtils.LogWarning(TAG, "No attached providers found! Most of Profile functionality fill be unavaliable.");
}
mProviders = new HashMap<>();
for (Class<? extends IProvider> aClass : providerClass) {
try {
IProvider provider = aClass.newInstance();
IProvider.Provider targetProvider = provider.getProvider();
if (profileParams != null) {
Map<String, String> providerParams = profileParams.get(targetProvider);
provider.configure(providerParams);
}
mProviders.put(targetProvider, provider);
} catch (Exception e) {
String err = "Couldn't instantiate provider class. Something's totally wrong here. " + e.getLocalizedMessage();
SoomlaUtils.LogError(TAG, err);
}
}
}
示例4: applyLoggedInUser
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
private void applyLoggedInUser(final IProvider.Provider provider, UserProfile targetProfile) {
if (targetProfile == null)
{
SoomlaUtils.LogWarning(TAG, "Logged-in user profile was not found in " + provider + " provider");
return;
}
Log.d(TAG, "Provider Name = " + provider);
Toast.makeText(this, provider + " connected", Toast.LENGTH_SHORT).show();
showView(mProfileBar, true);
new DownloadImageTask(mProfileAvatar).execute(targetProfile.getAvatarLink());
if(targetProfile.getFirstName() != null) {
mProfileName.setText(targetProfile.getFullName());
}
else {
mProfileName.setText(targetProfile.getUsername());
}
updateUIOnLogin(provider);
// TEST
// todo: it seems that FB no longer simply returns your friends via me/friends
// todo: need to figure out what's best here
SoomlaProfile.getInstance().getContacts(provider, null);
SoomlaProfile.getInstance().getFeed(provider, null);
}
示例5: initialize
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
* Initializes the Profile module. Call this method after <code>Soomla.initialize()</code>
* @param activity The parent activity
* @param usingExternalProvider If using an external SDK (like Unity FB SDK) pass true
* here so we know not to complain about native providers
* not found
* @param providerParams provides custom values for specific social providers
*/
public boolean initialize(Activity activity, boolean usingExternalProvider, Map<IProvider.Provider, ? extends Map<String, String>> providerParams) {
if (mInitialized) {
String err = "SoomlaStore is already initialized. You can't initialize it twice!";
SoomlaUtils.LogError(TAG, err);
return false;
}
mProviderManager = new ProviderManager(providerParams,
"com.soomla.profile.social.facebook.SoomlaFacebook",
"com.soomla.profile.social.google.SoomlaGooglePlus",
"com.soomla.profile.social.twitter.SoomlaTwitter"
);
mInitialized = true;
BusProvider.getInstance().post(new ProfileInitializedEvent());
if (activity == null) {
SoomlaUtils.LogWarning(TAG,
"You want to use `autoLogin`, but have not provided the `activity`. Skipping auto login");
return false;
}
this.settleAutoLogin(activity);
return true;
}
示例6: configure
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void configure(Map<String, String> providerParams) {
autoLogin = false;
if (providerParams != null) {
twitterConsumerKey = providerParams.get("consumerKey");
twitterConsumerSecret = providerParams.get("consumerSecret");
// extract autoLogin
String autoLoginStr = providerParams.get("autoLogin");
autoLogin = autoLoginStr != null && Boolean.parseBoolean(autoLoginStr);
}
SoomlaUtils.LogDebug(TAG, String.format(
"ConsumerKey:%s ConsumerSecret:%s",
twitterConsumerKey, twitterConsumerSecret));
if (TextUtils.isEmpty(twitterConsumerKey) || TextUtils.isEmpty(twitterConsumerSecret)) {
SoomlaUtils.LogError(TAG, "You must provide the Consumer Key and Secret in the SoomlaProfile initialization parameters");
isInitialized = false;
}
else {
isInitialized = true;
}
oauthCallbackURL = "oauth://soomla_twitter" + twitterConsumerKey;
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.setOAuthConsumerKey(twitterConsumerKey);
configurationBuilder.setOAuthConsumerSecret(twitterConsumerSecret);
Configuration configuration = configurationBuilder.build();
twitter = new AsyncTwitterFactory(configuration).getInstance();
if (!actionsListenerAdded) {
SoomlaUtils.LogWarning(TAG, "added action listener");
twitter.addListener(actionsListener);
actionsListenerAdded = true;
}
}
示例7: queryPurchases
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
* Restores purchases from Google Play.
*
* @throws JSONException
* @throws RemoteException
*/
private int queryPurchases(IabInventory inv, String itemType) throws JSONException, RemoteException {
// Query purchases
SoomlaUtils.LogDebug(TAG, "Querying owned items, item type: " + itemType);
SoomlaUtils.LogDebug(TAG, "Package name: " + SoomlaApp.getAppContext().getPackageName());
boolean verificationFailed = false;
String continueToken = null;
do {
SoomlaUtils.LogDebug(TAG, "Calling getPurchases with continuation token: " + continueToken);
Bundle ownedItems = mService.getPurchases(3, SoomlaApp.getAppContext().getPackageName(),
itemType, continueToken);
int response = getResponseCodeFromBundle(ownedItems);
SoomlaUtils.LogDebug(TAG, "Owned items response: " + String.valueOf(response));
if (response != IabResult.BILLING_RESPONSE_RESULT_OK) {
SoomlaUtils.LogDebug(TAG, "getPurchases() failed: " + IabResult.getResponseDesc(response));
return response;
}
if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST)
|| !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST)
|| !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) {
SoomlaUtils.LogError(TAG, "Bundle returned from getPurchases() doesn't contain required fields.");
return IabResult.IABHELPER_BAD_RESPONSE;
}
ArrayList<String> ownedSkus = ownedItems.getStringArrayList(
RESPONSE_INAPP_ITEM_LIST);
ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(
RESPONSE_INAPP_PURCHASE_DATA_LIST);
ArrayList<String> signatureList = ownedItems.getStringArrayList(
RESPONSE_INAPP_SIGNATURE_LIST);
SharedPreferences prefs =
SoomlaApp.getAppContext().getSharedPreferences(SoomlaConfig.PREFS_NAME, Context.MODE_PRIVATE);
String publicKey = prefs.getString(TapClashIabService.PUBLICKEY_KEY, "");
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = purchaseDataList.get(i);
String signature = signatureList.get(i);
String sku = ownedSkus.get(i);
if (Security.verifyPurchase(publicKey, purchaseData, signature)) {
SoomlaUtils.LogDebug(TAG, "Sku is owned: " + sku);
IabPurchase purchase = new IabPurchase(itemType, purchaseData, signature);
if (TextUtils.isEmpty(purchase.getToken())) {
SoomlaUtils.LogWarning(TAG, "BUG: empty/null token!");
SoomlaUtils.LogDebug(TAG, "IabPurchase data: " + purchaseData);
}
// Record ownership and token
inv.addPurchase(purchase);
}
else {
SoomlaUtils.LogWarning(TAG, "IabPurchase signature verification **FAILED**. Not adding item.");
SoomlaUtils.LogDebug(TAG, " IabPurchase data: " + purchaseData);
SoomlaUtils.LogDebug(TAG, " Signature: " + signature);
verificationFailed = true;
}
}
continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
SoomlaUtils.LogDebug(TAG, "Continuation token: " + continueToken);
} while (!TextUtils.isEmpty(continueToken));
return verificationFailed ? IabResult.IABHELPER_VERIFICATION_FAILED : IabResult.BILLING_RESPONSE_RESULT_OK;
}
示例8: failListener
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
private static void failListener(int requestedAction, String message) {
switch (requestedAction) {
case ACTION_LOGIN: {
RefLoginListener.fail("Login failed: " + message);
break;
}
case ACTION_PUBLISH_STATUS: {
RefSocialActionListener.fail("Publish status failed: " + message);
break;
}
case ACTION_PUBLISH_STATUS_DIALOG: {
RefSocialActionListener.fail("Publish status dialog failed: " + message);
break;
}
case ACTION_PUBLISH_STORY: {
RefSocialActionListener.fail("Publish story failed: " + message);
break;
}
case ACTION_PUBLISH_STORY_DIALOG: {
RefSocialActionListener.fail("Publish story dialog failed: " + message);
break;
}
case ACTION_UPLOAD_IMAGE: {
RefSocialActionListener.fail("Upload Image failed: " + message);
break;
}
case ACTION_GET_FEED: {
RefFeedListener.fail("Get feed failed: " + message);
break;
}
case ACTION_GET_CONTACTS: {
RefContactsListener.fail("Get contacts failed: " + message);
break;
}
case ACTION_GET_USER_PROFILE: {
RefUserProfileListener.fail("Get user profile failed: " + message);
break;
}
default: {
SoomlaUtils.LogWarning(TAG, "action unknown fail listener:" + requestedAction);
break;
}
}
clearListener(requestedAction);
}
示例9: clearListener
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
private static void clearListener(int requestedAction) {
SoomlaUtils.LogDebug(TAG, "Clearing Listeners " + requestedAction);
switch (requestedAction) {
case ACTION_LOGIN: {
RefLoginListener = null;
break;
}
case ACTION_PUBLISH_STATUS: {
RefSocialActionListener = null;
break;
}
case ACTION_PUBLISH_STATUS_DIALOG: {
RefSocialActionListener = null;
break;
}
case ACTION_PUBLISH_STORY: {
RefSocialActionListener = null;
break;
}
case ACTION_PUBLISH_STORY_DIALOG: {
RefSocialActionListener = null;
break;
}
case ACTION_UPLOAD_IMAGE: {
RefSocialActionListener = null;
break;
}
case ACTION_GET_FEED: {
RefFeedListener = null;
break;
}
case ACTION_GET_CONTACTS: {
RefContactsListener = null;
break;
}
case ACTION_GET_USER_PROFILE: {
RefUserProfileListener = null;
break;
}
default: {
SoomlaUtils.LogWarning(TAG, "action unknown clear listener:" + requestedAction);
break;
}
}
}
示例10: clearListeners
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
private void clearListeners() {
SoomlaUtils.LogDebug(TAG, "Clearing Listeners");
switch (preformingAction) {
case ACTION_LOGIN: {
RefLoginListener = null;
break;
}
case ACTION_PUBLISH_STATUS: {
RefSocialActionListener = null;
break;
}
case ACTION_PUBLISH_STATUS_DIALOG: {
RefSocialActionListener = null;
break;
}
case ACTION_PUBLISH_STORY: {
RefSocialActionListener = null;
break;
}
case ACTION_PUBLISH_STORY_DIALOG: {
RefSocialActionListener = null;
break;
}
case ACTION_UPLOAD_IMAGE: {
RefSocialActionListener = null;
break;
}
case ACTION_GET_FEED: {
RefFeedListener = null;
break;
}
case ACTION_GET_CONTACTS: {
RefContactsListener = null;
break;
}
case ACTION_INVITE: {
RefInviteListener = null;
break;
}
default: {
SoomlaUtils.LogWarning(TAG, "action unknown:" + preformingAction);
break;
}
}
}
示例11: queryPurchases
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
* Restores purchases from Google Play.
*
* @throws JSONException
* @throws RemoteException
*/
private int queryPurchases(IabInventory inv, String itemType) throws JSONException, RemoteException {
// Query purchases
SoomlaUtils.LogDebug(TAG, "Querying owned items, item type: " + itemType);
SoomlaUtils.LogDebug(TAG, "Package name: " + SoomlaApp.getAppContext().getPackageName());
boolean verificationFailed = false;
String continueToken = null;
do {
SoomlaUtils.LogDebug(TAG, "Calling getPurchases with continuation token: " + continueToken);
if (mService == null) {
if (service != null) {
mService = IInAppBillingService.Stub.asInterface(service);
} else {
return IabResult.IABHELPER_VERIFICATION_FAILED;
}
}
Bundle ownedItems = mService.getPurchases(3,
SoomlaApp.getAppContext().getPackageName(),
itemType, continueToken);
int response = getResponseCodeFromBundle(ownedItems);
SoomlaUtils.LogDebug(TAG, "Owned items response: " + String.valueOf(response));
if (response != IabResult.BILLING_RESPONSE_RESULT_OK) {
SoomlaUtils.LogDebug(TAG, "getPurchases() failed: " + IabResult.getResponseDesc(response));
return response;
}
if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST)
|| !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST)
|| !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) {
SoomlaUtils.LogError(TAG, "Bundle returned from getPurchases() doesn't contain required fields.");
return IabResult.IABHELPER_BAD_RESPONSE;
}
ArrayList<String> ownedSkus = ownedItems.getStringArrayList(
RESPONSE_INAPP_ITEM_LIST);
ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(
RESPONSE_INAPP_PURCHASE_DATA_LIST);
ArrayList<String> signatureList = ownedItems.getStringArrayList(
RESPONSE_INAPP_SIGNATURE_LIST);
SharedPreferences prefs =
SoomlaApp.getAppContext().getSharedPreferences(SoomlaConfig.PREFS_NAME, Context.MODE_PRIVATE);
String publicKey = prefs.getString(GooglePlayIabService.PUBLICKEY_KEY, "");
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = purchaseDataList.get(i);
String signature = signatureList.get(i);
String sku = ownedSkus.get(i);
if (Security.verifyPurchase(publicKey, purchaseData, signature)) {
SoomlaUtils.LogDebug(TAG, "Sku is owned: " + sku);
IabPurchase purchase = new IabPurchase(itemType, purchaseData, signature);
if (TextUtils.isEmpty(purchase.getToken())) {
SoomlaUtils.LogWarning(TAG, "BUG: empty/null token!");
SoomlaUtils.LogDebug(TAG, "IabPurchase data: " + purchaseData);
}
// Record ownership and token
inv.addPurchase(purchase);
}
else {
SoomlaUtils.LogWarning(TAG, "IabPurchase signature verification **FAILED**. Not adding item.");
SoomlaUtils.LogDebug(TAG, " IabPurchase data: " + purchaseData);
SoomlaUtils.LogDebug(TAG, " Signature: " + signature);
verificationFailed = true;
}
}
continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
SoomlaUtils.LogDebug(TAG, "Continuation token: " + continueToken);
} while (!TextUtils.isEmpty(continueToken));
return verificationFailed ? IabResult.IABHELPER_VERIFICATION_FAILED : IabResult.BILLING_RESPONSE_RESULT_OK;
}
示例12: queryPurchases
import com.soomla.SoomlaUtils; //导入方法依赖的package包/类
/**
* Restores purchases from Nokia Store
*
* @throws JSONException
* @throws RemoteException
*/
private int queryPurchases(IabInventory inv, String itemType) throws JSONException, RemoteException {
// Query purchases
SoomlaUtils.LogDebug(TAG, "Querying owned items, item type: " + itemType);
SoomlaUtils.LogDebug(TAG, "Package name: " + SoomlaApp.getAppContext().getPackageName());
boolean verificationFailed = false;
String continueToken = null;
//TODO: Tofix
ArrayList<String> products = new ArrayList<String>(StoreInfo.getAllProductIds());
Bundle queryBundle = new Bundle();
queryBundle.putStringArrayList("ITEM_ID_LIST", products);
do {
SoomlaUtils.LogDebug(TAG, "Calling getPurchases with continuation token: " + continueToken);
Bundle ownedItems = mService.getPurchases(3, SoomlaApp.getAppContext().getPackageName(),
ITEM_TYPE_INAPP, queryBundle, continueToken);
int response = getResponseCodeFromBundle(ownedItems);
SoomlaUtils.LogDebug(TAG, "Owned items response: " + String.valueOf(response));
if (response != IabResult.BILLING_RESPONSE_RESULT_OK) {
SoomlaUtils.LogDebug(TAG, "getPurchases() failed: " + IabResult.getResponseDesc(response));
return response;
}
if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST)
|| !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST)
//|| !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)
) {
SoomlaUtils.LogError(TAG, "Bundle returned from getPurchases() doesn't contain required fields.");
return IabResult.IABHELPER_BAD_RESPONSE;
}
ArrayList<String> ownedSkus = ownedItems.getStringArrayList(
RESPONSE_INAPP_ITEM_LIST);
ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(
RESPONSE_INAPP_PURCHASE_DATA_LIST);
SharedPreferences prefs =
SoomlaApp.getAppContext().getSharedPreferences(SoomlaConfig.PREFS_NAME, Context.MODE_PRIVATE);
String publicKey = prefs.getString(NokiaStoreIabService.PUBLICKEY_KEY, "");
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = purchaseDataList.get(i);
String sku = ownedSkus.get(i);
if (Security.verifyPurchase(publicKey, purchaseData)) {
SoomlaUtils.LogDebug(TAG, "Sku is owned: " + sku);
IabPurchase purchase = new IabPurchase(itemType, purchaseData, "");
if (TextUtils.isEmpty(purchase.getToken())) {
SoomlaUtils.LogWarning(TAG, "BUG: empty/null token!");
SoomlaUtils.LogDebug(TAG, "IabPurchase data: " + purchaseData);
}
// Record ownership and token
inv.addPurchase(purchase);
}
else {
SoomlaUtils.LogWarning(TAG, "IabPurchase signature verification **FAILED**. Not adding item.");
SoomlaUtils.LogDebug(TAG, " IabPurchase data: " + purchaseData);
verificationFailed = true;
}
}
continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
SoomlaUtils.LogDebug(TAG, "Continuation token: " + continueToken);
} while (!TextUtils.isEmpty(continueToken));
return verificationFailed ? IabResult.IABHELPER_VERIFICATION_FAILED : IabResult.BILLING_RESPONSE_RESULT_OK;
}