Untitled
plain_text
18 days ago
2.3 kB
0
Indexable
Never
import android.content.Context; import android.content.IntentFilter; import android.text.TextUtils; import android.util.Log; import com.netcore.android.Smartech; import java.lang.ref.WeakReference; import com.netcore.android.logger.SMTDebugLevel; import com.netcore.android.smartechpush.SmartPush; import com.netcore.android.smartechpush.notification.SMTNotificationOptions; import com.netcore.smartech.sample.receiver.BroadcastReceiver; public class MainApplication extends android.app.Application { private static final String TAG = "smartech"; @Override public void onCreate() { super.onCreate(); //initialise the sdk Smartech smartech= Smartech.getInstance(new WeakReference<>(this)); smartech.initializeSdk(this); smartech.trackAppInstallUpdateBySmartech();//Tracking app install/update event. smartech.setDebugLevel(SMTDebugLevel.Level.VERBOSE);//Enabling Smartech sdk logs for testing. // fetch exist token from firebase app try { SmartPush smartPush = SmartPush.getInstance(new WeakReference<>(this)); smartPush.fetchAlreadyGeneratedTokenFromFCM(); } catch (Exception e) { } // enabling logs for nudges prodcut HSLLogLevel.min.setEnabled(true); HSLLogLevel.all.setEnabled(true); HSLLogLevel.mid.setEnabled(true); HSLLogLevel.debug.setEnabled(true); /** * This method will register the broadcast receiver for foreground push notification and deep link clicks. **/ //deeplink BroadcastReceiver deeplinkReceiver = new BroadcastReceiver(); IntentFilter filter = new IntentFilter("com.smartech.EVENT_PN_INBOX_CLICK"); registerReceiver(deeplinkReceiver, filter); //notification icon SMTNotificationOptions options = new SMTNotificationOptions(this); options.setBrandLogo(String.valueOf(R.drawable.img_netcore)); //e.g.logo is sample name for brand logo options.setLargeIcon(String.valueOf(R.drawable.img_netcore));//e.g.ic_notification is sample name for large icon options.setTransparentIconBgColor("#ff5f00"); SmartPush.getInstance(new WeakReference(this)).setNotificationOptions(options);