在我的应用程序中,我希望每天在特定时间运行一些代码AlarmManager.在android文档中我发现了这个:
设备处于睡眠状态时会保留已注册的警报,但如果已关闭并重新启动,则会将其清除.
这就是问题所在.即使用户重新启动手机,我也想运行代码.如果用户重新启动手机,他当前必须重新启动我的应用以再次启动闹钟.我怎么能阻止这个?我应该使用更好的机制吗?
我的网站上有一个按钮,单击此按钮会显示一个电话号码.
HTML
<div class="call-wrapper-middle">
<button id="call-phone-middle"><i class="fa fa-phone"></i>Call us</button>
<div class="call-number-middle" style="display: block;"> <a href="tel:555" class="number">555</a></div>
</div>
Run Code Online (Sandbox Code Playgroud)
使用以下jQuery
(function($) {
$("button#call-phone-middle").click(function() {
$(this).hide();
$("div.call-number-middle").show();
});
})(jQuery);
Run Code Online (Sandbox Code Playgroud)
这非常有效.但我也希望跟踪按钮上的点击次数作为Google Analytics中的目标.
所以我添加href="/show/phonenumber-middle" onclick="javascript:pageTracker._trackPageview (‘Phonenumber Middle’);" target="blank"到按钮:
<div class="call-wrapper-middle">
<button href="/show/phonenumber-middle" onclick="javascript:pageTracker._trackPageview (‘Phonenumber Middle’);" target="blank" id="call-phone-middle"><i class="fa fa-phone"></i>Call us</button>
<div class="call-number-middle" style="display: block;"> <a href="tel:555" class="number">555</a></div>
</div>
Run Code Online (Sandbox Code Playgroud)
并使用以下设置在Google Analytics中添加了目标:
目标设定:Custom
目标类型:Destination
目的地; 等于:/show/phonenumber-middle
获取"此目标将根据您的数据获得0%的转化率",而在实时报告中则没有对话.
我的猜测是有问题,<button>但我不知道.
我试图从GitHub运行一个简单的Android聊天应用程序.我认为我的HAXM配置存在问题.当我运行应用程序时,我看到这些错误:
HAXM is not working and emulator runs in emulation mode
emulator The memory needed by this AVD exceeds the max specified in your HAXM configuration.
emulator: AVD RAM size = 1536 MB
emulator: HAXM max RAM size = 768 MB
emulator: You might want to adjust your AVD RAM size and/or HAXM configuration to run in fast virt mode.
emulator: warning: opening audio output failed creating window 61 83 462 820
emulator: emulator window was out of view and …Run Code Online (Sandbox Code Playgroud) 当我通过App-Change按钮再次打开一个关闭的应用程序时,我收到此错误消息:
Caused by: java.lang.InstantiationException: can't instantiate class com.*.FragmentContact$1; no empty constructor
Run Code Online (Sandbox Code Playgroud)
我已经找到了几个关于Inner-Classes的技巧并使它们成为静态等等.但是这个FragmentContact是一个*.java文件中的公共类,并且有一个公共的空构造函数.我在这个项目中使用谷歌地图Api v2,并在互联网上的某个地方设置我的MapView.看这里:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_contact, null);
try {
MapsInitializer.initialize(this.getActivity().getApplicationContext());
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
fragment = new SupportMapFragment() {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mMap = fragment.getMap();
if (mMap != null) {
setupMap();
}
}
};
getFragmentManager().beginTransaction().replace(R.id.fragment_orte_map_parent, fragment).commit();
return v;
}
Run Code Online (Sandbox Code Playgroud)
当我剪切这个MapView东西时,一切正常.也许有人可以解释我做错了什么.
我完整的Stacktrace:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable …Run Code Online (Sandbox Code Playgroud) 我该如何使用RxJava TestScheduler?我来自.NET背景,但TestSchedulerRxJava似乎与.NET rx中的测试调度程序的工作方式不同.
这是我想测试的示例代码
Observable<Long> tick = Observable.interval(1, TimeUnit.SECONDS);
contactsRepository.find(index)
.buffer(MAX_CONTACTS_FETCH)
.zipWith(tick, new Func2<List<ContactDto>, Long, List<ContactDto>>() {
@Override
public List<ContactDto> call(List<ContactDto> contactList, Long aLong) {
return contactList;
}
}).subscribe()
Run Code Online (Sandbox Code Playgroud)
我试过了:
subscribeOn(testScheduler)
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
testScheduler.triggerActions();
Run Code Online (Sandbox Code Playgroud)
没有运气.
I am struggling to get the emulator launch successfully after trying for over 2 weeks. I can really use some help with the issue or tips on troubleshooting the same.
I have been able to launch the emulator successfully on my home machine using very similar config. It fails when I connect from my work PC, I believe there is a some configuration that may be stopping this, but I have no clue what that configuration is and I don't …
我记得在三星BLE API(存档页面)的"指南和提示" -doc中阅读:
三星F/W和堆栈最重要的概念之一是它的同步特性.也就是说,如果我们调用例如
writeCharacteristic某个特定的特性,如果它返回true,则在收到回调后应该对anyBluetoothGatt或BluetoothGattServer方法进行下一次调用onCharacteristicRead.这是因为堆栈被设计为一次仅支持和处理一个GATT调用,例如,如果您在第一个调用之后很快调用writeCharacteristic或readCharacteristic处理任何特性,则忽略它.
是否可以检测设备何时进入打盹/待机状态?我无法在Android文档中找到有关可能启用或创建的可能广播接收器或侦听器的任何内容,以便接收这些转换的通知.
我是java spring安全的新手,并且遵循Spring.io 教程指南.作为其中的一部分,我WebSecurityConfig根据需要编辑了课程:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/home").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
@Bean
@Override
public UserDetailsService userDetailsService() {
UserDetails user =
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build();
return new InMemoryUserDetailsManager(user);
}
}
Run Code Online (Sandbox Code Playgroud)
在该userDetailService()方法中,它使用withDefaultPasswordEncoder()现在已弃用,如文档中所示:withDefaultPasswordEncoder()
不幸的是,我没有找到替代方案,在不使用弃用方法的情况下完成本教程.如果可能,有人能为此提供替代方案吗?
谢谢!
注意:我附上了几个错误的屏幕截图,以及我的gradle文件
我有一个可以在模拟器和自己的设备上正常运行的应用程序。但是,当我在视图之间导航时,会收到消息
No package ID ff found for ID 0xffffffff.
Run Code Online (Sandbox Code Playgroud)
每时每刻。我不知道这意味着什么或它来自哪里。
在日志中搜索,我还会发现以下消息:
I/low.wordscanne: The ClassLoaderContext is a special shared library.
2019-04-10 16:25:10.984 26226-26226/? I/chatty:uid=10099(com.myapp.erikbylow.wordscanner) identical 2 lines
2019-04-10 16:25:10.985 26226-26226/? I/low.wordscanne: The ClassLoaderContext is a special shared library.
2019-04-10 16:25:10.992 26226-26226/? W/low.wordscanne: Unsupported class loader
Run Code Online (Sandbox Code Playgroud)
而且MainActivity - onCreate我总是得到这个警告
Accessing hidden method Landroid/graphics/FontFamily;-><init>()V (light greylist, reflection)
2019-04-10 16:26:24.328 26226-26226/com.myapp.myname.wordscanner W/low.wordscanne: Accessing hidden method Landroid/graphics/FontFamily;->addFontFromAssetManager(Landroid/content/res/AssetManager;Ljava/lang/String;IZIII[Landroid/graphics/fonts/FontVariationAxis;)Z (light greylist, reflection)
2019-04-10 16:26:24.328 26226-26226/com.myapp.myname.wordscanner W/low.wordscanne: Accessing hidden method Landroid/graphics/FontFamily;->addFontFromBuffer(Ljava/nio/ByteBuffer;I[Landroid/graphics/fonts/FontVariationAxis;II)Z (light greylist, reflection)
2019-04-10 16:26:24.328 …Run Code Online (Sandbox Code Playgroud) android ×7
button ×1
constructor ×1
fragment ×1
gatt ×1
haxm ×1
java ×1
javascript ×1
jquery ×1
reboot ×1
restart ×1
rx-java ×1
spring ×1
spring-boot ×1
spring-mvc ×1