Feedify SDK is Android API framework built top on Feedify API Implement your feedify notifications in your mobile apps rapidly.
INSTALLATION
Installation is very straight forward, you need to add app in your firebase console. You can follow this guide Firebase Setup. Skip apply google-services plugin,this should be handled by Feedify SDK itself. Just download google-services.json.
Now copy this google-services.json into your root of app assets directory this is important step. Note this location is different than mentioned in official document, since it's handled by SDK not by plugin.
On your project level gradle make sure to add class path
class path 'com.google.gms:google-services:4.2.0'
Ignore this line in your app level gradle. (do not add this line)
apply plugin: 'com.google.gms.google-services'
DEPENDENCIES
Add following dependencies in your app gradle.
implementation 'com.github.feedify:feed-notify:0.0.1'
//support dependencies (required by SDK)
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.preference:preference:1.0.0"
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.android.volley:volley:1.1.1'
CREDENTIALS SETTING
Login to your feedify console and set your firebase cloud-messaging
API Key and project-id under:
Setting > Setting > Push Sending Settings
Finally add feedify credentials to your app under strings.xml as follow:
These strings will automatically detect and used by Feedify SDK.
In case not mentioned you'll get exception.
Make sure to change your credentials in string value.
That's all done!.
You can test push notification from your feedify console.
ADVANCED USER
You can extend application class as follow and change notification icon and on click event.
In case event not defined it will open notification url in browser. Don't forgot to specify
application class in your app Android Manifest.xml.
public class MyApplication extends FeedSDK { @Override public void onCreate() { super.onCreate(); //set notification small icon (optional) setNotificationIcon(R.drawable.ic_stat_notifications); //this activity will be open when clicked on notification (optional) setStartActivity(MyActivity.class); } }
In case you need to handle other firebase notification you can extend 'FirebaseMessagingService' as follow:
public class CustomMessageHandler extends FeedMessagingService { //Note all 'FirebaseMessagingService' feature is available since'FeedMessagingService' extended by FeedMessagingService' @Override public void onMessageReceived(@NonNull RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); } }
In your app Android Manifest.xml:
Additionally you can turn off/on notification as follow:
// turn off notification
FeedSDK.setEnabled(false);
//check status
boolean isEnabled = FeedSDK.isEnabled();