0

I'm building in app with Phonegap and Xtify for pushing messages. I receive the messages but no sound and vibration. How to enable them?

There's no function in XtifyCordovaPlugin.js. There's only a function in the SDK named "NotificationsPreference.setSoundEnabled(context, true);" It requires a context. What is the context?

My Activity.Main

package com.example.test;

import android.app.Activity;
import android.app.Notification;
import android.content.Context;
import android.os.Bundle;
import org.apache.cordova.*;

import com.xtify.cordova.XtifyCordovaPlugin;
import com.xtify.sdk.NotificationsUtility;
import com.xtify.sdk.api.NotificationsPreference;

public class MainActivity extends DroidGap {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
        XtifyCordovaPlugin.processActivityExtras(getIntent().getExtras(), this);

        //The Line
        NotificationsPreference.setSoundEnabled(context, true);
    }
}

Thanks in advance yor your help!

1 Answers1

1

In this situation you can use:

NotificationsPreference.setSoundEnabled(this, true);

MainActivity extends DroidGap which extends Activity which extends Context. So in effect DroidGap is a Context.

Simon MacDonald
  • 23,253
  • 5
  • 58
  • 74