How to setup Android Firebase Notification in Manifest? - android

I'm trying to setup Firebase notifications. I did changes in app level and root level build.gradle. But still, its giving me error in Manifest for MyFirebaseMessagingService. Error is Unresolved Class.
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".s" />
<activity android:name=".im" />
<activity android:name=".Main2Activity" />
<activity android:name=".sactivity" />
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<activity
android:name=".ScrollingActivity"
android:label="#string/title_activity_scrolling"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>

Looks like the Android Manifest file can't locate the MyFirebaseMessagingService class. I'd suggest you to put the fully qualified package name of the class. See example below:
<service android:name="com.android.notification.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

Oh! you haven't create any java class here, lets just get around it since |service| is instantiated to true on default.You should make android:enabled="false",i think this should work. see detail code below.
<service android:enabled="false" android:name="MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>

<service android:name="com.fcm.MyFirebaseMessagingServices">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.fcm.MyFirebaseInstanceIdServices">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>

Related

My Custom BroadcastReceiver is not working above API level 16

I'm doing my college project which was Parental Control app. In that I'm creating a Custom Receiver. I'm tested that app in jelly bean,kitkat,lollipop, marshmallow, naughat ,oreo. But it only works in jelly bean and kitkat. I'm tried reading all solutions in stackoverflow. Please give solution for me!
manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.nizam.training.parentalcontrol">
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<application
android:fullBackupContent="false"
android:allowBackup="true"
android:icon="#mipmap/m"
android:label="#string/app_name"
android:logo="#mipmap/ico"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<service
android:name=".BlockService"
android:enabled="true"
android:exported="true"/>
<activity android:name=".AppSettingActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".BlockActivity"
android:theme="#style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".MainActivity"
android:theme="#style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:label="Login"
android:theme="#style/MyTheme" />
<activity
android:name=".SignupActivity"
android:label="Create Pin"
android:theme="#style/MyTheme" />
<activity
android:name=".TaskList"
android:label="Tasks"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="true"
android:permission=""
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="StartupReceiver_Manual_Start" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</receiver>
<receiver android:name=".CheckRunningApplicationReceiver" />
</application></manifest>
Calling broabcast in TaskListActivity.java
getApplicationContext.sendBroadcast(new Intent("StartupReceiver_Manual_Start"))
LogCat
http://mnktalktech.blogspot.com/2019/02/logcat-for-parentalcontrol.html
I found this; it might be part of the issue. Are you getting any errors?
GET_TASKS Permission Deprecated
Please try with this.
<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="false"
>
<intent-filter>
<action android:name="StartupReceiver_Manual_Start"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</receiver>
and let me know.
After spending a week in this issue I have found solution for this.
What I put before (which is not working)...
getApplicationContext.sendBroadcast(new Intent("StartupReceiver_Manual_Start"))
Now I just changed.
MyReceiver mr=new MyReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("StarctupReceiver_Manual_Start");
registerReceiver(mr,intentFilter);
getBaseContext().getApplicationContext().sendBroadcast(new Intent("StarctupReceiver_Manual_Start"));
I don't know why it is working but it works.If anyone know the reason please comment. Thanks for all who tried to solve this issue.

Android studio unable to recognize default activity after changing it in manifest file

I've an android app where LoginActivity was main activity. I created a SplashScreen activty, then changed AndroidManifest as given below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dell.inventoryplay">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:name=".InventoryPlayApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true">
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.dell.inventoryplay.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<activity
android:name=".main.SplashActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
android:label="#string/app_name"
android:launchMode="singleTop"
android:theme="#style/DellTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".main.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:exported="false"
android:label="#string/app_name"
android:launchMode="singleTop"
android:theme="#style/DellTheme.NoActionBar"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<activity
android:name=".main.LoginActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/DellThemeFullscreen" />
<receiver
android:name=".alarm.AlarmReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.NOTIFY" />
</intent-filter>
</receiver>
<receiver
android:name=".alarm.BootReceiver"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name=".AirWatchSDKContextService"/>
<service android:name=".AirWatchSDKIntentService"/>
</application>
</manifest>
When I try to run modified android app, it shows error as given below:
Error running app: Default activity not found.
I've added
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
to SplashActivity. But it isn't recognizing that as default activity. How can I fix it?
This should be category instead of action so use this
<category android:name="android.intent.category.LAUNCHER"/>
instead of
<action android:name="android.intent.category.LAUNCHER"/>
<activity
android:name=".main.SplashActivity"
android:configChanges="orientation|screenSize"
android:exported="false"
android:label="#string/app_name"
android:launchMode="singleTop"
android:theme="#style/DellTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

Parse deviceToken empty after ParseInstallation save

I am working on an app where I use Parse to send and receive notifications. The problem now is that when I register an installation deviceToken is empty (deviceType and installationId aren't empty). When this token is empty I can't receive any notifications.
How I register the installation:
Parse.initialize(this, "x", "x");
ParseInstallation.getCurrentInstallation().saveInBackground();
When I added all the code for Parse to my app (https://www.parse.com/apps/quickstart#parse_push/android/native/existing) everything was working fine.
My AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxx.xxx" >
<uses-sdk android:maxSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.xxx.xxx.permission.C2D_MESSAGE" />
<uses-permission android:name="com.xxx.xxx.permission.C2D_MESSAGE" />
<application
android:name="com.xxx.xxx.Name_"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:logo="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="#xml/global_tracker" />
<activity
android:name="com.xxx.xxx.Activities.SplashActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.xxx.xxx.Activities.LoginActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.xxx.xxx.Activities.ForgotPassword_"
android:screenOrientation="portrait"
android:label="#string/app_name">
</activity>
<activity
android:name="com.xxx.xxx.Activities.MainActivity_"
android:screenOrientation="portrait"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.xxx.xxx.Activities.EditProfile_"
android:screenOrientation="portrait"
android:label="#string/edit_profile" >
</activity>
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name=".Receiver.MyPushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.xxx.xxx" />
</intent-filter>
</receiver>
</application>
</manifest>
I just created a new application, added Parse and deleted the Installation class/table in Parse but still no deviceToken.
I think it's a bug in the new Parse SDK. I downgraded to 1.9.0 and everything works fine now.
Source: https://groups.google.com/forum/#!topic/parse-developers/a1Z0SSC304M

Eclipse showing No launcher Activity found

This is my android Manifest.xml.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="uk.co.halfninja.wallpaper.parallax">
<uses-sdk android:minSdkVersion="7" />
<uses-feature android:name="android.software.live_wallpaper" />
<application
android:label="#string/app_name"
android:icon="#drawable/icon">
<service
android:label="#string/app_name"
android:name=".ParallaxWallpaper"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.service.wallpaper" android:resource="#xml/wallpaper" />
</service>
<activity
android:label="#string/wallpaper_settings"
android:name=".ParallaxWallpaperSettings"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:exported="true">
</activity>
</application>
</manifest>
Still Eclipse showing the result
ParallaxWallpaper] No Launcher activity found!
ParallaxWallpaper] The launch will only sync the application package on the device!
ParallaxWallpaper] Performing sync
ParallaxWallpaper] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
Please let me Know where am i doing the mistake, and what would be the solution...???
Move the intent-filter tag from service to activity
These lines should be in Activity tag
<application
android:label="#string/app_name"
android:icon="#drawable/icon">
<activity
android:label="#string/wallpaper_settings"
android:name=".ParallaxWallpaperSettings"
android:theme="#android:style/Theme.Black.NoTitleBar" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:label="#string/app_name"
android:name=".ParallaxWallpaper"
android:permission="android.permission.BIND_WALLPAPER">
</service>
<meta-data android:name="android.service.wallpaper" android:resource="#xml/wallpaper" />
</application>
make activity as launcher you have made service as launcher. like that
<activity
android:label="#string/wallpaper_settings"
android:name=".ParallaxWallpaperSettings"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Program with widget

I want to develop a application with widget. Now i only can find the applicaion in widget but cannot find the application in "all programs"
Thank you
my AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.testing_v1_0" android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".MyActivity" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".testing123" android:label="#string/app_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:resource="#xml/widget_provider_full"
android:name="android.appwidget.provider">
</meta-data>
</receiver>
<service android:name=".testing123$UpdateService" />
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
<meta-data android:resource="#xml/widget_provider_full" android:name="android.appwidget.provider">
</meta-data>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
</manifest>
Ok you must have inside your Manifest.xml
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".GrupoReformaNews"
android:label="#string/app_name"
android:screenOrientation="portrait">
this in intent filter for your application
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
this in intent filter for your Widget
<receiver android:name="GR_Widget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/imageswidget_info" />
</receiver>
...
...
...
</application>
if you still having problems, post your manifest.xml

Categories

Resources