User Login

Please enter user name and password into following boxes!

If you are not registered yet, please click

Forget Password

If you forget your password, please click
favorite

Android Correct Usage Onesignal

When using onesignal as notification system in Android application, we should insert following codes in ApplicationManifest.xml file:

 <meta-data
            android:name="com.onesignal.NotificationOpened.DEFAULT"
            android:value="DISABLE" />

After adding this meta-data, Android will disable launcher activity to be opened.

Handle notification opened event as follows:

public class App extends Application {
    protected boolean active = true;
    protected int splashTime = 3000;

    @Override
    public void onCreate() {

        super.onCreate();
        MultiDex.install(getApplicationContext());

        OneSignal.startInit(this)
                .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
                .setNotificationOpenedHandler(new OneSignal.NotificationOpenedHandler() {
            @Override
            public void notificationOpened(OSNotificationOpenResult result) {
                String launchURL = null;
                try {
                    if (result.notification.payload.additionalData == null ||
                            result.notification.payload.additionalData.get("CATEGORYID") == null)
                        return;
                    Constant.CATEGORYID = Integer.valueOf(result.notification.payload.additionalData.get("CATEGORYID").toString());
                    Constant.PROJECTID = result.notification.payload.additionalData.get("PROJECTID").toString();
                    Intent intent = new Intent(getApplicationContext(), CategoryList_Activity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
                    //Log.e("item", ""+Constant.CATEGORY_ID);
                    startActivity(intent);

                } catch (JSONException e) {
                    Intent intent = new Intent(getApplicationContext(), Splash_Activity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(intent);
                }
            }
        }).init();

    }
}


PayPal - The safer, easier way to pay online!


Comments About Tutorial

There is no comment



Add Comment

Name*
Surname* 
Email* 
Subject* 
What is (12 + 5) :
WARNING

Please fill all text boxes

Message Result

Your comment is saved. After approved, it will be published

An Error Occured

We are sorry, your request cannot be continued try again later

LOGIN REQUESTED

Please login for this operation
Login