Support Topics Documentation Slack YouTube Blog

No matching client (NOT BACKENDLESS BUT Android Studio)

Mission: PUSH COMMANDER
Task: Register device for push notifications

This is not an issue with backendless but an error Im getting in Android Studio when I attempt to follow and run the task set in the above Backendless mission above.

If this is considered too far outside the scope of what you can assist with I totally accept that but I thought I’d chance my luck :slight_smile:

The Error message is

No matching client found for package name ‘com.example.backendless’

and looks like this

Hello @Graham_Reddie

You need to add the google-services.json file to your project as indicated in the instructions for setting up push notifications. https://backendless.com/docs/android/push_push_notification_setup_androi.html

If you have already done this, then make sure that the package name in the firebase console matches the package name of your application (you can see the package name in the AndroidManifest.xml)
https://monosnap.com/direct/YYxiDm8mODWcFTaQjDgbaxpsUX1siQ

Regards,
Inna

If any newbies also found this mission a little more challenging than the others (I’d not used Android Studio before) you may find it useful to cut and paste this into your mainactivity section of the app. Remember to change the API’s to your keys and these two parts were slightly different from the video but correct in the documentation (I was following the video ! :slight_smile: )

“context” changed to “getApplicationContext()”

and

“new ArrayList<~>();” should be “new ArrayList();”

====

package com.myapp.pushcommanderapp;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.widget.Toast;

import com.backendless.Backendless;
import com.backendless.DeviceRegistration;
import com.backendless.async.callback.AsyncCallback;
import com.backendless.exceptions.BackendlessFault;
import com.backendless.push.DeviceRegistrationResult;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Backendless.initApp( this, "YOURAPP_API","YOURANDROID_API");
    List<String> channels = new ArrayList<String>();
    channels.add( "default" );
    Backendless.Messaging.registerDevice(channels, new AsyncCallback<DeviceRegistrationResult>() {
        @Override
        public void handleResponse(DeviceRegistrationResult response) {
            Toast.makeText(getApplicationContext(),"SUCCESS !",Toast.LENGTH_SHORT).show();
        }

        @Override
        public void handleFault(BackendlessFault fault) {
            Toast.makeText(getApplicationContext(),"FAILED",Toast.LENGTH_SHORT).show();
        }
1 Like

Also make sure you completed the Firebase registration of your app !

Hi @Inna_Shkolnaya I finally completed the mission for registering the device and Firebase has confirmed it’s configured (see screenshot) but I’m not receiving the push notification on the emulator? What might I have missed, any ideas?

Hello @Graham_Reddie

Did you add an Android key to the Backendless console?
https://monosnap.com/direct/Fvj0evYbTPWkPSeV0e5Xd2xsoiGYlZ

Make sure to add a key for the channel you are sending push notifications to. Also make sure your device is registered for this channel.
https://monosnap.com/direct/bBY3FB2vPKqtAzrUE31Sf4WjelobN9
https://monosnap.com/direct/3umfjBzOvQPRigll40XCzQkdDJxUA8

It often happens that push notifications to the emulator do not come immediately, but after some time. Try to turn off and turn on the Internet connection on the emulator itself. If you have the opportunity, then you can try to install this application on a real android device.

Regards,
Inna

Hi @Inna_Shkolnaya,

I’ve added the Android key and selected ALL CHANNELS

all my devices, includes a real Android phone are registered for that channel

and the template is registered for the default too

I can successfully send push note from Firebase to the app on the phone directly just not through Backendless

Graham

@Graham_Reddie

I just checked the work in my application and push notifications come to the emulator (I turned off and on the wi-fi on the emulator)

Please provide your App ID. Would you mind if I add my key there and try to check the work of push notifications from there?

Regards

@Graham_Reddie

I just sent push notification from Backendless console and received it on the emulator.
However, when I tried to send your push template, it didn’t come to me either. Are you sure you copied the Android key from the firebase console correctly?

Regards,
Inna

push notification works fine from the console to android.
i can confirm this for my android app
i think its a channel issue

Thanks for confirming. I created it from scratch and it works fine although I don’t get the push notes on the emulators only on a real phone!

Thanks for all your help !