I.m going to make the new Android app using Firebase Cloud Message (topic system).
-Can I use Multi-subscribe systems(ex.topic1, topic2) in the android app?
-Can I see an example?
Does not matter Java or kotlin
Related
I am new to react-native.I am trying to build a simple android application that reads all the messages from the inbox and display it in a listview. In android,i can read all the messages using URI.
How can i read all the messages in a similar way using react-native?
Thanks in advance
In React native,you want to read sms from android phone:
react-native-get-sms-android
This module that supports interaction with the Messaging API on Android
The package allows you to:
• get messages
• send messages
• delete messages
Refer this for this module integration:react-native-get-sms-android
Make sure that you need specific permissions to read SMS for android.
For checking permissions in android,use PermissionsAndroid API.It provides access to Android M's new permissions model.For more details check this docs
react-native-android-sms-listener
To listen for the new messages in your app use this library.This library allows you to listen for incoming SMS messages.
Refer this for this module integration:react-native-android-sms-listener
Remember that everything that you did in Android, you can still do it in react Native, writing a Native Module, and here is a well explained example of how to do that https://facebook.github.io/react-native/docs/native-modules-android
Or I saw that there is this external library https://github.com/briankabiro/react-native-get-sms-android, that you might try.
I am using the Android SDK to send data to Google Analytics. In this project I cannot use Firebase nor GTM. I should send hits directly to GA. I have already implemented everything, events included. But I cannot create Content Groupings. I think that the follow code is deprecated, isn't it?
mTracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-XXXXXXXX-X");
mTracker.set(contentGroup(1), "Level");
Which is the correct implementation for creating Content Grouping with the Android SDK without using other platforms (I mean sending everything directly to GA)?
Thanks a lot.
I have created an android sample project using AWS Mobile Hub with User Sign-In and Push Notifications services.
I've downloaded the project and opened it through Android Studio, in order to take the necessary files for push notifications from the sample project and to integrate it in my existing Android app.
I thought it would be simple, but then I found out this huge files branch:
It is difficult to understand what files I do need and what files I don't need. Could you please help me to figure out what do I need to import into my existing project in order to integrate Push Notifications in my app?
You should copy the contents of MySampleApp/app/src/main/java/com/amazonaws verbatim into your new project and Also parts of AndroidManifest.xml and build.gradle and Application.java.
For a complete instruction, I would recommend that you go through Mobile Hub Console > Project Name > Build > Select Android > On Left side go to develop > Use as an Example.
You will find all the instructions you need for your android project
The "PushListenerService" class is basically a useful example class where the magic happens. So keep every file that support that class. The
private static void generateNotification(Context context, final String message)
is what displays the notification message.
Another important note is how to get the user's device endpoint value. This can be gotten using the "PushManager" class.
String endpoint = pushManager.getEndpointArn();
The endpoint ARN of a device help you send direct notification to that device.
PublishRequest publishRequest = new PublishRequest();
publishRequest.setMessage(message);
publishRequest.setSubject(subject);
publishRequest.withTargetArn(endpoint); //This can also be a "topic" ARN
snsClient.publish(publishRequest);
Pretty nice job done by the guys at AWS. Big thanks to them! :D
There is no easy way out. Just take your time and go through all the code in the classes that relate to the AWS service you want to implement. Good luck!
Btw, make sure your app is not open on the test device when you send a notification to it or else you won't see a notification since your app is already running. I notice this is a default behaviour.
I am writing a iOS and Android application that is supposed to notify users through the FCM API yet there seems to be a catch-22 within the firebase API that involves both platforms:
On Android, to handle new notifications using a custom implementation of FirebaseMessagingService.onMessageReceived(), one must create a DATA only message server-side. E.g: { "data": {"param": "foo" },"to" : "/topics/bar"}. The moment a "notification" field is included in the json, the custom implementation will not be called when the app is in the background. This would be ok but...
On iOS, if the "notification" field is not included in the message, the message just isn't received when the app is in the background which is unacceptable.
Thus, to receive background notification on iOS, you need to add the "notification" field, but adding this field makes the Android apps display bogus, non-customizable notifications when in the background!
I hope there is something that I am missing in the documentation. I would like to know how others have overcome this problem and whether it would be wise to stick with FCM for iOS or ditch it for something else.
I am successfully sending Push Notifications from the Mixpanel Dashboard to a Cordova app on both iOS and Android devices, using phonegap-plugin-push.
However, the title and body values entered in the default fields only appear on iOS devices.
For the notification to appear on Android devices, I currently need to include a custom payload in Mixpanels "Custom Data":
{
"title":"Title for Android only",
"body":"Content for Android only"
}
This is an error prone step for any non-technical using Mixpanel to send notifications.
Does someone know an easier way to do this?
The short answer here is that Cordova/Phonegap and similar third party frameworks are not 100% optimized for Mixpanel functionality (although they work pretty great), and as such you'll need to generate separate push notifications for both iOS and Android in your Mixpanel project.
Providing context, all iOS pushes regardless of app deliver a JSON payload to APN using the same keys to deliver their messages (alert, badge, sound). However, the keys that Android apps process for incoming GCM pushes are entirely dependent on how the GCM receiver is established, and therein lies the problem here.
Mixpanel's Android SDK initializes pushes and uses a GCM receiver that is specific to Mixpanel messages, and fully expects its custom keys (mp_message, mp_title) in order to render the notification. The webapp reformats the message input to meet these key requirements (http://bit.ly/1OGgU1y)
However, the Phonegap GCM receiver expects different keys as you've noticed. I'd recommend referring to the phonegap github page in order to get more context into the expected push format and behavior (looks like they expect "title" and "message" as the keys): http://bit.ly/1KDScye
Unfortunately, what this means is that the Android app is not optimized to receive the default, web-app generated Mixpanel pushes, although your iOS one is. Mixpanel's SDKs are intended to maximize capabilities for that platform, and it isn't guaranteed that Cordova or similar JS frameworks will translate 100%.
So to conclude - Creating a message in the Mixpanel push editor will send to iOS, but for Android you'll need to use the custom JSON payload in a separate notification, including keys that the phonegap GCM receiver is compatible with.
If its help to anyone this is how I solved the problem
in phonegap-plugin-push
you need to modify two files
GCMIntentService.java
private String normalizeKey(String key) {
if (key.equals(BODY) || key.equals(ALERT) || key.equals(MP_MESSAGE) || key.equals(GCM_NOTIFICATION_BODY)) { // added MP_MESSAGE
PushConstants.java
public static final String MP_MESSAGE = "mp_message";