Posts tagged with java

We do this sort of thing: https://developers.google.com/google-ads/api/docs/samples/generate-forecast-metrics

and the results we get are radically different from what we see using the Google Ads web UI, given precisely the same parameters. The API call always gives a lower number of clicks, by a factor of up to about 2x.

Also: We don't see any of the KeywordPlans, KeywordPlanAdGroups, or KeywordPlanCampaigns that we create programmatically in the UI. This is a real pity, as it would really help to debug things.

I am new to Google Adwords. I have completed all initial configuration and integration required to use Adwords API. I have a test client account and I am able to get campaigns from that account. I also completed uploading offline data integration.

 // Upload offline data on the server and print some information.     OfflineDataUploadReturnValue returnValue =         offlineDataUploadService.mutate(operations.toArray(new OfflineDataUploadOperation[0]));     offlineDataUpload = returnValue.getValue(0);     System.out.printf(     "Uploaded offline data with external upload ID %d, and upload status %s.%n",     offlineDataUpload.getExternalUploadId(), offlineDataUpload.getUploadStatus()); 

But when I run the code to upload the data, I am facing below error:-

Request failed due to ApiException. Underlying ApiErrors:   Error 0: NotWhitelistedError{apiErrorType=NotWhitelistedError, errorString=NotWhitelistedError.CUSTOMER_NOT_WHITELISTED_FOR_API, fieldPath=, reason=CUSTOMER_NOT_WHITELISTED_FOR_API, trigger=} 

As I said earlier I am new to the Google AdWords, so any suggestion and help will be gladly appreciated. Thank you in advance!

I'm developing an Android app that creates a whitelist of over 400 contacts and groups of WhatsApp to send them a scheduled message. I found an API to send a message using WhatsApp by passing the message and the receipt contact (person or group), but I didn't find another API to get all group ids of WhatsApp.

How to retrieve all WhatsApp groups' ids, using Android Java?

My AdMob banner is not showing in my android application. After seeing older questions about the same problem none helped because they refer to a previous version of android studio. Now some things have become deprecated.

My NewRecord.java file contatins the following code:

package com.example.anxietycalendar; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import com.akaita.android.circularseekbar.CircularSeekBar; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.InterstitialAd; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.initialization.InitializationStatus; import com.google.android.gms.ads.initialization.OnInitializationCompleteListener; import java.text.DateFormat; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class NewRecord extends AppCompatActivity {     DatabaseHelper myDB;     private Button Submit;     public float pr;     private AdView mAdView;     private InterstitialAd mInterstitialAd;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_new_record);         MobileAds.initialize(this, new OnInitializationCompleteListener() {             @Override             public void onInitializationComplete(InitializationStatus initializationStatus) {             }         });         mAdView = findViewById(R.id.adView);         AdRequest adRequest = new AdRequest.Builder().build();         mAdView.loadAd(adRequest);         mAdView.setAdListener(new AdListener() {                                   @Override                                   public void onAdFailedToLoad(int errorCode) {                                       String onAdFailedToLoad = null;                                       Log.d(onAdFailedToLoad, "This is why: " + errorCode);                                   }         });         myDB=new DatabaseHelper(this);         Submit= (Button) findViewById(R.id.submit);         CircularSeekBar seekBar = (CircularSeekBar) findViewById(R.id.seekbar);         seekBar.setProgressTextFormat(new DecimalFormat("###,###,###,##0.00"));         seekBar.setProgress(0);         seekBar.setRingColor(Color.GREEN);         seekBar.setOnCircularSeekBarChangeListener(new CircularSeekBar.OnCircularSeekBarChangeListener() {             @Override             public void onProgressChanged(CircularSeekBar seekBar, float progress, boolean fromUser) {                 if (progress < 5) {                     seekBar.setRingColor(Color.GREEN);                     pr = progress;                 } else if (progress < 8) {                     seekBar.setRingColor(Color.YELLOW);                     pr = progress;                 } else {                     seekBar.setRingColor(Color.RED);                     pr = progress;                 }             }             @Override             public void onStartTrackingTouch(CircularSeekBar seekBar) {             }             @Override             public void onStopTrackingTouch(CircularSeekBar seekBar) {             }         });         Submit.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {                 myDB.insertData(Math.round(pr));             }         });     } } 

While the activity_new_record.xml contains the following code:

<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@drawable/background"     tools:context=".NewRecord">     <TextView         android:id="@+id/perctext"         android:layout_width="281dp"         android:layout_height="36dp"         android:layout_marginTop="36dp"         android:background="@drawable/bg_calen2"         android:ems="10"         android:gravity="center"         android:inputType="textPersonName"         android:text="How much stress do you feel?"         android:textColor="@color/white"         app:layout_constraintEnd_toEndOf="parent"         app:layout_constraintHorizontal_bias="0.43"         app:layout_constraintStart_toStartOf="parent"         app:layout_constraintTop_toTopOf="parent" />     <com.akaita.android.circularseekbar.CircularSeekBar         android:id="@+id/seekbar"         android:layout_width="300dp"         android:layout_height="224dp"         android:layout_marginTop="52dp"         app:enabled="true"         app:innerCircleColor="#e0f7e9"         app:layout_constraintHorizontal_bias="0.495"         app:layout_constraintLeft_toLeftOf="parent"         app:layout_constraintRight_toRightOf="parent"         app:layout_constraintTop_toBottomOf="@+id/perctext"         app:max="10"         app:min="0"         app:progress="1"         app:progressTextColor="@android:color/black"         app:progressTextSize="26"         app:ringColor="@color/colorAccent"         app:ringWidth="0.5"         app:showIndicator="true"         app:showInnerCircle="true"         app:showProgressText="true"         app:speedMultiplier="2" />     <Button         android:id="@+id/submit"         style="@style/BlueButton"         android:layout_width="271dp"         android:layout_height="31dp"         android:text="Submit Record"         app:layout_constraintBottom_toBottomOf="parent"         app:layout_constraintEnd_toEndOf="parent"         app:layout_constraintStart_toStartOf="parent"         app:layout_constraintTop_toBottomOf="@+id/seekbar"         app:layout_constraintVertical_bias="0.168" />     <com.google.android.gms.ads.AdView         android:id="@+id/adView"         xmlns:ads="http://schemas.android.com/apk/res-auto"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignParentBottom="true"         android:layout_centerHorizontal="true"         ads:adSize="BANNER"         ads:adUnitId="ca-app-pub-6417467530528623/7094248892"         ads:layout_constraintBottom_toBottomOf="parent"         ads:layout_constraintEnd_toEndOf="parent"         ads:layout_constraintHorizontal_bias="0.615"         ads:layout_constraintStart_toStartOf="parent"         ads:layout_constraintTop_toBottomOf="@+id/submit"         ads:layout_constraintVertical_bias="0.198" /> </androidx.constraintlayout.widget.ConstraintLayout> 

This is the activity where I am trying to add the banner app. I have tried to use the test ad unit Id's but it is still failing.

I would also like to add this part of the code of the AndroidManifest.xml:

<application         android:allowBackup="true"         android:icon="@mipmap/ic_launcher"         android:label="Anxiety Calendar"         android:roundIcon="@mipmap/ic_launcher_round"         android:supportsRtl="true"         android:theme="@style/AppTheme"         tools:replace="android:label">         <activity android:name=".Statistics"></activity>         <!-- Include the AdActivity configChanges and theme. -->         <activity             android:name="com.google.android.gms.ads.AdActivity"             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"             android:theme="@android:style/Theme.Translucent" /> <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->         <meta-data             android:name="com.google.android.gms.ads.APPLICATION_ID"             android:value="ca-app-pub-6417467530528623~3872355031" /> 

How do I fix this? I have been trying for days... I am using a Galaxy Nexus API 22 simulator.