我正在一个Android 6中测试一个应用程序,我需要通过DOZE,因为我想请求用户接受电池优化的重要性.
在项目 AntiDoze中,但是当我在虚拟设备中运行时我没有任何问题,但是当我传递给三星时,我得到:
FATAL EXCEPTION: main
Process: com.commonsware.android.antidoze, PID: 21135
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.commonsware.android.antidoze/com.commonsware.android.antidoze.EventDemoActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS dat=package:com.commonsware.android.antidoze }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
Run Code Online (Sandbox Code Playgroud)
知道如何传递这个问题吗?
链接中重要的代码是:
if (Build.VERSION.SDK_INT>Build.VERSION_CODES.LOLLIPOP_MR1) {
String pkg=getPackageName();
PowerManager pm=getSystemService(PowerManager.class);
if (!pm.isIgnoringBatteryOptimizations(pkg)) {
Intent i=
new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
.setData(Uri.parse("package:"+pkg));
startActivity(i);
}
}
Run Code Online (Sandbox Code Playgroud)
在我的清单中
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 emailjs ( https://github.com/eleith/emailjs ) 通过 nodejs 发送电子邮件,但是,它给了我一个错误:{ [错误:连接到 smtp 服务器时超时] 代码:4, smtp: 未定义 }
我正在尝试使用 hotmail,但我可以使用其他的,我只希望它工作。请问有什么想法吗?
var email = require("emailjs");
var server = email.server.connect({
user: "xxx@hotmail.com",
password:"xxxyyyy",
host: "smtp-mail.live.com",
ssl: true
});
// send the message and get a callback with an error or details of the message that was sent
server.send({
text: "i hope this works",
from: "you <xxxxxx@hotmail.com>",
to: "someone <zzzzz@hotmail.com>",
//cc: "else <else@your-email.com>",
subject: "testing emailjs"
}, function(err, message) { console.log(err || message); });
Run Code Online (Sandbox Code Playgroud) 我想要一种方法来获取网站中的所有src和href属性(如图像和链接).我怎么能在javascript中做到这一点?我试试这个:
var ilist=document.links;
for(var i = 0; i < ilist.length; i++) {
if(ilist[i].href) {
alert(ilist[i].href)
}
}
Run Code Online (Sandbox Code Playgroud)
但对某事来说,这不起作用.只适用于.我想要所有标签的所有href和所有src.有谁能够帮我?
我正在编译sipXtapi,我需要用这一行编译
gcc -shared -DPIC .libs/codec_pcmapcmu_la-CodecPcmaWrapper.o .libs/codec_pcmapcmu_la-CodecPcmuWrapper.o .libs/codec_pcmapcmu_la-G711.o .libs/codec_pcmapcmu_la-PlgPcmaPcmu.o -lc -W1,-soname=codec_pcmapcmu.so -o .libs/codec_pcmapcmu.so
gcc: error: unrecognized command line option ‘-W1,-soname=codec_pcmapcmu.so’
Run Code Online (Sandbox Code Playgroud)
这是Makefile.am:
## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/../sipXportLib/include -I$(top_srcdir)/contrib/libspandsp/src
pkgdata_LTLIBRARIES = codec_pcmapcmu.la
codec_pcmapcmu_la_SOURCES = \
CodecPcmaWrapper.c \
CodecPcmuWrapper.c \
G711.c \
PlgPcmaPcmu.c
if PCMAPCMU_STATIC
codec_pcmapcmu_la_CFLAGS = -DCODEC_STATIC
codec_pcmapcmu_la_LDFLAGS = -module -avoid-version -static else
codec_pcmapcmu_la_LDFLAGS = -module -avoid-version
all-local: codec_pcmapcmu.la
echo "Installing plugin codec_pcmapcmu.so ..."
cp -f .libs/codec_pcmapcmu.so @DEFAULT_CODECS_PATH@
clean-local:
rm -f …Run Code Online (Sandbox Code Playgroud) javascript ×2
web ×2
android ×1
android-doze ×1
attributes ×1
c++ ×1
email ×1
gcc ×1
image ×1
makefile ×1
node.js ×1
smtp ×1
src ×1