Java Code Examples for com.facebook.ads.AdSettings.addTestDevice()

The following are Jave code examples for showing how to use addTestDevice() of the com.facebook.ads.AdSettings class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: pubnative-android-sdk   File: Facebook.java   Source Code and License Vote up 6 votes
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));
    }
}
 
Example 2
Project: react-native-fbads   File: AdSettingsManager.java   Source Code and License Vote up 5 votes
@ReactMethod
public void addTestDevice(String deviceHashedId) {
    if (deviceHashedId == "current") {
        SharedPreferences sp = getReactApplicationContext()
            .getSharedPreferences("FBAdPrefs", 0);

        deviceHashedId = sp.getString("deviceIdHash", null);
    }
    AdSettings.addTestDevice(deviceHashedId);
}
 
Example 3
Project: Sportmix   File: TrtsporFragment.java   Source Code and License Vote up 5 votes
@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;
}
 
Example 4
Project: Sportmix   File: FotomacFragment.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 5
Project: Sportmix   File: SporxFragment.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 6
Project: Sportmix   File: SabahFragment.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 7
Project: Sportmix   File: EuroSportFragment.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 8
Project: Sportmix   File: LigTvFragment.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 9
Project: Sportmix   File: GoalComFragment.java   Source Code and License Vote up 4 votes
@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;
}
 
Example 10
Project: Sportmix   File: HaberTurkFragment.java   Source Code and License Vote up 4 votes
@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;
}