当前位置: 首页>>代码示例>>Java>>正文


Java AdSettings类代码示例

本文整理汇总了Java中com.facebook.ads.AdSettings的典型用法代码示例。如果您正苦于以下问题:Java AdSettings类的具体用法?Java AdSettings怎么用?Java AdSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdSettings类属于com.facebook.ads包,在下文中一共展示了AdSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.facebook.ads.AdSettings; //导入依赖的package包/类
public static void init(Context context) {
    
    AdSettings.setMediationService(MEDIATION_SERVICE_NAME);
    AdSettings.setIsChildDirected(PNSettings.isCoppaModeEnabled);
    if (PNSettings.isTestModeEnabled) {
        AdSettings.addTestDevice(PNCrypto.md5(PNSettings.advertisingId));
        FacebookTestModeHelper.updateHashId(context, PNCrypto.md5(PNSettings.advertisingId));
    }
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:10,代码来源:Facebook.java

示例2: addTestDevice

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@ReactMethod
public void addTestDevice(String deviceHashedId) {
    if (deviceHashedId == "current") {
        SharedPreferences sp = getReactApplicationContext()
            .getSharedPreferences("FBAdPrefs", 0);

        deviceHashedId = sp.getString("deviceIdHash", null);
    }
    AdSettings.addTestDevice(deviceHashedId);
}
 
开发者ID:callstack,项目名称:react-native-fbads,代码行数:11,代码来源:AdSettingsManager.java

示例3: onCreateView

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.layout_aspor_fragment, container, false);

    swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_layout);
  /*  alertDialog=new SpotsDialog(getActivity(),R.style.Custom_Progress_Dialog);
    setCustomAlertDialog();*/
    // fillTheData();


    swipeRefreshLayout.setOnRefreshListener(this);

    // Configure the refreshing colors
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    swipeRefreshLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    swipeRefreshLayout.setRefreshing(true);

                                    fetchAllNews();
                                    swipeRefreshLayout.setRefreshing(false);
                                }
                            }
    );

    //init native ads manager
    listNativeAdsManager = new NativeAdsManager(getActivity(),
            getString(R.string.test_facebook_unit_id),
            getResources().getInteger(R.integer.max_pull_ad_number));
    if (getString(R.string.test_ad_mode).equals("T")){
        AdSettings.addTestDevice(getString(R.string.test_device_id));
    }
    listNativeAdsManager.setListener(this);
    listNativeAdsManager.loadAds();
    return v;
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:42,代码来源:TrtsporFragment.java

示例4: inflateAd

import com.facebook.ads.AdSettings; //导入依赖的package包/类
private void inflateAd(NativeAd nativeAd, View adView) {
    // Create native UI using the ad metadata.
    ImageView nativeAdIcon = (ImageView) adView.findViewById(R.id.native_ad_icon);
    TextView nativeAdTitle = (TextView) adView.findViewById(R.id.native_ad_title);
    TextView nativeAdBody = (TextView) adView.findViewById(R.id.native_ad_body);
    MediaView nativeAdMedia = (MediaView) adView.findViewById(R.id.native_ad_media);
    nativeAdMedia.setAutoplay(AdSettings.isVideoAutoplay());
    TextView nativeAdSocialContext =
            (TextView) adView.findViewById(R.id.native_ad_social_context);
    Button nativeAdCallToAction = (Button) adView.findViewById(R.id.native_ad_call_to_action);

    // Setting the Text
    nativeAdSocialContext.setText(nativeAd.getAdSocialContext());
    nativeAdCallToAction.setText(nativeAd.getAdCallToAction());
    nativeAdCallToAction.setVisibility(View.VISIBLE);
    nativeAdTitle.setText(nativeAd.getAdTitle());
    nativeAdBody.setText(nativeAd.getAdBody());

    // Downloading and setting the ad icon.
    NativeAd.Image adIcon = nativeAd.getAdIcon();
    NativeAd.downloadAndDisplayImage(adIcon, nativeAdIcon);

    // Downloading and setting the cover image.
    NativeAd.Image adCoverImage = nativeAd.getAdCoverImage();
    int bannerWidth = adCoverImage.getWidth();
    int bannerHeight = adCoverImage.getHeight();
    DisplayMetrics metrics = myContext.getResources().getDisplayMetrics();
    int mediaWidth = adView.getWidth() > 0 ? adView.getWidth() : metrics.widthPixels;
    nativeAdMedia.setLayoutParams(new LinearLayout.LayoutParams(
            mediaWidth,
            Math.min(
                    (int) (((double) mediaWidth / (double) bannerWidth) * bannerHeight),
                    metrics.heightPixels / 7))); // eskiden 3
    nativeAdMedia.setNativeAd(nativeAd);

    // Wire up the View with the native ad, the whole nativeAdContainer will be clickable.
    nativeAd.registerViewForInteraction(adView);
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:39,代码来源:PostItemAdapter.java

示例5: clearTestDevices

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@ReactMethod
public void clearTestDevices() {
    AdSettings.clearTestDevices();
}
 
开发者ID:callstack,项目名称:react-native-fbads,代码行数:5,代码来源:AdSettingsManager.java

示例6: setIsChildDirected

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@ReactMethod
public void setIsChildDirected(boolean isDirected) {
    AdSettings.setIsChildDirected(isDirected);
}
 
开发者ID:callstack,项目名称:react-native-fbads,代码行数:5,代码来源:AdSettingsManager.java

示例7: setMediationService

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@ReactMethod
public void setMediationService(String mediationService) {
    AdSettings.setMediationService(mediationService);
}
 
开发者ID:callstack,项目名称:react-native-fbads,代码行数:5,代码来源:AdSettingsManager.java

示例8: setUrlPrefix

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@ReactMethod
public void setUrlPrefix(String urlPrefix) {
    AdSettings.setUrlPrefix(urlPrefix);
}
 
开发者ID:callstack,项目名称:react-native-fbads,代码行数:5,代码来源:AdSettingsManager.java

示例9: buildAdRequest

import com.facebook.ads.AdSettings; //导入依赖的package包/类
private void buildAdRequest(MediationAdRequest adRequest) {
    if (adRequest != null) {
        AdSettings.setIsChildDirected((adRequest.taggedForChildDirectedTreatment()
                == MediationAdRequest.TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE));
    }
}
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:7,代码来源:FacebookAdapter.java

示例10: onCreateView

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.layout_fotomac_fragment, container, false);

    swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_layout);
  /*  alertDialog=new SpotsDialog(getActivity(),R.style.Custom_Progress_Dialog);
    setCustomAlertDialog();*/
    // fillTheData();


    swipeRefreshLayout.setOnRefreshListener(this);

    // Configure the refreshing colors
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    swipeRefreshLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    swipeRefreshLayout.setRefreshing(true);

                                    fetchAllNews();
                                    swipeRefreshLayout.setRefreshing(false);
                                }
                            }
    );

    //init native ads manager
    listNativeAdsManager = new NativeAdsManager(getActivity(),
            getString(R.string.test_facebook_unit_id),
            getResources().getInteger(R.integer.max_pull_ad_number));
    if (getString(R.string.test_ad_mode).equals("T")){
        AdSettings.addTestDevice(getString(R.string.test_device_id));
    }
    listNativeAdsManager.setListener(this);
    listNativeAdsManager.loadAds();
    return v;
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:42,代码来源:FotomacFragment.java

示例11: onCreateView

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.layout_sporx_fragment, container, false);

    swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_layout);
  /*  alertDialog=new SpotsDialog(getActivity(),R.style.Custom_Progress_Dialog);
    setCustomAlertDialog();*/
    // fillTheData();


    swipeRefreshLayout.setOnRefreshListener(this);

    // Configure the refreshing colors
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    swipeRefreshLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    swipeRefreshLayout.setRefreshing(true);

                                    fetchAllNews();
                                    swipeRefreshLayout.setRefreshing(false);
                                }
                            }
    );

    //init native ads manager
    listNativeAdsManager = new NativeAdsManager(getActivity(),
            getString(R.string.test_facebook_unit_id),
            getResources().getInteger(R.integer.max_pull_ad_number));
    if (getString(R.string.test_ad_mode).equals("T")){
        AdSettings.addTestDevice(getString(R.string.test_device_id));
    }
    listNativeAdsManager.setListener(this);
    listNativeAdsManager.loadAds();
    return v;
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:42,代码来源:SporxFragment.java

示例12: onCreateView

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.layout_sabah_fragment, container, false);

    swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_layout);
  /*  alertDialog=new SpotsDialog(getActivity(),R.style.Custom_Progress_Dialog);
    setCustomAlertDialog();*/
    // fillTheData();


    swipeRefreshLayout.setOnRefreshListener(this);

    // Configure the refreshing colors
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    swipeRefreshLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    swipeRefreshLayout.setRefreshing(true);

                                    fetchAllNews();
                                    swipeRefreshLayout.setRefreshing(false);
                                }
                            }
    );

    //init native ads manager
    listNativeAdsManager = new NativeAdsManager(getActivity(),
            getString(R.string.test_facebook_unit_id),
            getResources().getInteger(R.integer.max_pull_ad_number));
    if (getString(R.string.test_ad_mode).equals("T")){
        AdSettings.addTestDevice(getString(R.string.test_device_id));
    }
    listNativeAdsManager.setListener(this);
    listNativeAdsManager.loadAds();
    return v;
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:42,代码来源:SabahFragment.java

示例13: onCreateView

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.layout_ligtv_fragment, container, false);

    swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_layout);
  /*  alertDialog=new SpotsDialog(getActivity(),R.style.Custom_Progress_Dialog);
    setCustomAlertDialog();*/
    // fillTheData();


    swipeRefreshLayout.setOnRefreshListener(this);

    // Configure the refreshing colors
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    swipeRefreshLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    swipeRefreshLayout.setRefreshing(true);

                                    fetchAllNews();
                                    swipeRefreshLayout.setRefreshing(false);
                                }
                            }
    );

    //init native ads manager
    listNativeAdsManager = new NativeAdsManager(getActivity(),
            getString(R.string.test_facebook_unit_id),
            getResources().getInteger(R.integer.max_pull_ad_number));
    if (getString(R.string.test_ad_mode).equals("T")){
        AdSettings.addTestDevice(getString(R.string.test_device_id));
    }
    listNativeAdsManager.setListener(this);
    listNativeAdsManager.loadAds();
    return v;
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:42,代码来源:LigTvFragment.java

示例14: onCreateView

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.layout_ntvspor_fragment, container, false);

    swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_layout);
  /*  alertDialog=new SpotsDialog(getActivity(),R.style.Custom_Progress_Dialog);
    setCustomAlertDialog();*/
    // fillTheData();


    swipeRefreshLayout.setOnRefreshListener(this);

    // Configure the refreshing colors
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    swipeRefreshLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    swipeRefreshLayout.setRefreshing(true);

                                    fetchAllNews();
                                    swipeRefreshLayout.setRefreshing(false);
                                }
                            }
    );

    //init native ads manager
    listNativeAdsManager = new NativeAdsManager(getActivity(),
            getString(R.string.test_facebook_unit_id),
            getResources().getInteger(R.integer.max_pull_ad_number));
    if (getString(R.string.test_ad_mode).equals("T")){
        AdSettings.addTestDevice(getString(R.string.test_device_id));
    }
    listNativeAdsManager.setListener(this);
    listNativeAdsManager.loadAds();
    return v;
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:42,代码来源:GoalComFragment.java

示例15: onCreateView

import com.facebook.ads.AdSettings; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.layout_haberturk_fragment, container, false);

    swipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_layout);
  /*  alertDialog=new SpotsDialog(getActivity(),R.style.Custom_Progress_Dialog);
    setCustomAlertDialog();*/
    // fillTheData();


    swipeRefreshLayout.setOnRefreshListener(this);

    // Configure the refreshing colors
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);

    swipeRefreshLayout.post(new Runnable() {
                                @Override
                                public void run() {
                                    swipeRefreshLayout.setRefreshing(true);

                                    fetchAllNews();
                                    swipeRefreshLayout.setRefreshing(false);
                                }
                            }
    );

    //init native ads manager
    listNativeAdsManager = new NativeAdsManager(getActivity(),
            getString(R.string.test_facebook_unit_id),
            getResources().getInteger(R.integer.max_pull_ad_number));
    if (getString(R.string.test_ad_mode).equals("T")){
        AdSettings.addTestDevice(getString(R.string.test_device_id));
    }
    listNativeAdsManager.setListener(this);
    listNativeAdsManager.loadAds();
    return v;
}
 
开发者ID:aknkaplanoglu,项目名称:Sportmix,代码行数:42,代码来源:HaberTurkFragment.java


注:本文中的com.facebook.ads.AdSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。