[英]xtify + phonegap enable sound and vibration
I'm building in app with Phonegap and Xtify for pushing messages. 我正在使用Phonegap和Xtify在应用程序中构建消息推送功能。 I receive the messages but no sound and vibration.
我收到消息,但没有声音和振动。 How to enable them?
如何启用它们?
There's no function in XtifyCordovaPlugin.js. XtifyCordovaPlugin.js中没有任何功能。 There's only a function in the SDK named "NotificationsPreference.setSoundEnabled(context, true);"
SDK中只有一个名为“ 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! 在此先感谢您的帮助!
In this situation you can use: 在这种情况下,您可以使用:
NotificationsPreference.setSoundEnabled(this, true);
MainActivity extends DroidGap which extends Activity which extends Context. MainActivity扩展了DroidGap,后者扩展了Activity,后者又扩展了Context。 So in effect DroidGap is a Context.
因此,实际上DroidGap是一个上下文。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.