Firebase registration token is empty? - android

I'm trying to add push notification support for my Android app. I think Ravi Tramada's code makes a nice starting point, so I take it.
Basically I just copied his code. I've added both MyFirebaseInstanceID.java and MyFirebaseMessagingService.java as service in AndroidManifest.xml. Nothing happens. Every time I run the app, it always says "Firebase reg ID is not recieved yet" .
I've uploaded the whole app to this repository. Could someone enlighten my what goes wrong here?

I show your code in GitHub
Write your service inside application tag like this:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Firebase Notifications -->
<service android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<!-- ./Firebase Notifications -->
</application>
</manifest>

Related

Problem with android manifest when creating flutter appbundle

I have a problem with the android xml file when creating the appBundle. However, I cannot find the problem, could anyone help me please? I have never removed anything from the file. I have never really worked with manifest files before, so I wasn't completely sure what I was looking for.
Thanks in advance
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="-----------------">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".Application"
android:label="Pravachaka Sabdam"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:showWhenLocked="true"
android:turnScreenOn="true"
>
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android: name="android.permission.INTERNET" android:maxSdkVersion="28" />
</manifest>
Error Message
Error parsing LocalFile: 'A:\Flutter\BETA TEST FOLDER\Android\one\android\app\src\main\AndroidManifest.xml' Please ensure that the android manifest is a valid XML document andtry again.
Ok, you have a space character between android and name while defining internet permission. You need to remove that:
<uses-permission android:name="android.permission.INTERNET" android:maxSdkVersion="28" />
I was able to find the issue.
The issue was that there was an unnecessary space after android here:
<uses-permission android: name="android.permission.INTERNET" android:maxSdkVersion="28" />
I changed this to :
<uses-permission android:name="android.permission.INTERNET" android:maxSdkVersion="28" />

How does the premium version of Here sdk api work?

I signed up with Here sdk Api (Lite version) and I got a 'Freemium' account with an access_key_id and a secret_key as well. Now I want to upgrade my Freemium to Premium because I need the navigation tool for my application and they gave me an app code, api code and licence key (in the same account). when I built the application all I got is a blank page with a button and no errors in my terminal.
My Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.here_map_nav">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:hardwareAccelerated="true"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.here.android.maps.appid"
android:value="XXX" />
<meta-data
android:name="com.here.android.maps.apptoken"
android:value="XXX" />
<meta-data
android:name="com.here.android.maps.license.key"
android:value="XXX" />
<service
android:name="com.here.android.mpa.service.MapService"
android:label="{YOUR_LABEL_NAME}"
android:exported="false">
<intent-filter>
<action android:name="{YOUR_INTENT_NAME}"/>
</intent-filter>
</service>
</application>
By the way I don't know what to put in {YOUR_INTENT_NAME} and {YOUR_LABEL_NAME} . I don't know if it's the main problem or I should create an account for a premium version with my billing infos (since each account takes only one project)
Any help or clarifications would be appreciated!
try using below manifest.xml, it seems like action.VIEW is missing in yours.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data android:name="com.here.sdk.access_key_id" android:value="xx" />
<meta-data android:name="com.here.sdk.access_key_secret" android:value="xx" />
<activity android:name=".MainActivity">
<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>
</application>

Android Wear Authorization not Working

I created an app for the Wear operating system.
I used Android Studio 3.1.3
In this app I inserted a button and on the click of this I would like the watch to vibrate.
The problem is that the permissions of the app do not work.
I entered the request for vibration permission in the manifest, but when I start the app on the clock does not require me permissions and if I check the permissions registered for the app tells me that no authorization is required.
where am I wrong?
this is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ginetto.martinelli.warehousenotification">
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.WAKE_LOCK" android:requiredFeature="true" />
<uses-permission android:name="android.permission.VIBRATE" android:requiredFeature="true"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#android:style/Theme.DeviceDefault">
<uses-library
android:name="com.google.android.wearable"
android:required="true" />
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="#string/default_notification_channel_id"/>
</application>
</manifest>

OUTDATED DEVICE: Parse Push Notification to Android devices

Hi have worked with parse for saving data. But notification is something i am stuck with. I am not able figure out what's going wrong.
I have done all the receiver registrations and so my device also gets registered in the installation table but while sending push from web console it says "push sent 0" looking into the description of each push it shows that "OUTDATED DEVICE - The records on this installation are outdated, the user might have uninstalled the app." But I just did the registration.
I am going mad with this...no clue in what am I doing wrong, I am using eclipse IDE, Can anyone please suggest me any Solution??
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.parsecomlogin"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.example.parsecomlogin.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.parsecomlogin.permission.C2D_MESSAGE" />
<permission
android:name="com.example.parsecomlogin.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.parsecomlogin.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<application
android:name=".ParseApp"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Added for Parse push notifications -->
<!-- My custom receiver -->
<receiver
android:name=".ParseReceiver"
android:enabled="true"
android:exported="false" >
<intent-filter>
<action android:name="com.example.parsecomlogin.RECEIVE_PUSH" />
</intent-filter>
</receiver>
<!-- END my custom receiver -->
<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="com.parse.ParsePushBroadcastReceiver"
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.example.parsecomlogin" />
</intent-filter>
</receiver>
<activity
android:name=".Welcome"
android:label="#string/title_activity_welcome" >
</activity>
<activity
android:name=".LoginActivity"
android:label="#string/title_login" >
</activity>
<activity
android:name=".LoginSignupActivity"
android:label="#string/title_activity_login_signup" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDZ5TG28QJnN5zMyIdezPllvrfrwg7ElQs" />
</application>
</manifest>
I faced exactly the same problem and I fixed it a few minutes ago by coincidence. I hope the problem can be solved with the same touch-up for you as well.
In my situation, I used one of the older projects I worked and I have changed manifest package name manually in a way. In AndroidManifest.xml file, the manifest package name was changed to "com.myprojectname". There was no problem and app can run without any error with this package name. Also, all of Parse features run problem-free except push notification service. Then I checked other paths with Ctrl + Shift + R and searched whether R.java uses the same name. Unsurprisingly, the package name was identical in this file but I realized that in the lines below R.java uses the pattern of "net.myprojectname.app" instead of "com.myprojectname". I replaced "com.myprojectname" with "net.myprojectname.app" in all files by using Ctrl + Shift + R again. I think it was not the cause of the problem but I tried to send a last push notification desperately. It is hard to believe but it is worked. I got the notification successfully after all.
I answered the question in a highly informal and non-technical way but I have no idea about the underlying cause, I just want to help. Maybe it works for you. Good luck.

Activity doesn't open when the user taps on the notification

In my app main activity doesn't open when the user taps on the notification
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mx.com.eluniversal.test.pruebapushtags">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17" />
<permission android:name="mx.com.eluniversal.test.pruebapushtags.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="mx.com.eluniversal.test.pruebapushtags.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher" android:label="#string/app_name" android:theme="#style/AppTheme">
<activity android:name="mx.com.eluniversal.test.pruebapushtags.ActivityPrincipal" android:label="#string/app_name" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="mx.com.eluniversal.test.pruebapushtags.ActivityPrincipal.NOTIFICATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.worklight.wlclient.ui.UIActivity" />
<service android:name="com.worklight.wlclient.push.GCMIntentService" />
<receiver android:name="com.worklight.wlclient.push.WLBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="mx.com.eluniversal.test.pruebapushtags" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="mx.com.eluniversal.test.pruebapushtags" />
</intent-filter>
</receiver>
</application>
</manifest>
It doesn't open if the app is on the background and doesn't update the information in the activity while in the foreground when a new push notification arrives.
You can take a look at the following Native Android sample application that demonstrates implementing Tag-based push notifications: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/notifications/push-notification-native-android-applications/tag-based-notifications/
Compare its files with yours (AndroidManifest.xml, strings.xml, ...).
Since you are not responding in the comments, that's the best that can be done at this time.
Note: This application is based on MobileFirst Platform 7.0, so you cannot open the project file in previous releases. However, you can still extract the .zip file and look at the source files from the file system.

Categories

Resources