我(基本上)需要在iOS 4上创建一个后台计时器,这将允许我在经过特定时间后执行一些代码.我已经读过你可以用一些来完成这个[NSThread detachNewThreadSelector:
toTarget:
withObject:];但是在实践中它是如何工作的?如何确保线程也保留在后台.本地通知将不为我工作,因为我需要执行代码,不通知用户.
帮助将不胜感激!
我正在Android上使用Phonegap [Cordova 2.2]开发"Reminders"应用程序.
用户输入提醒的具体日期,我应该按时通知他.
我使用Android的Notification Plugin,但它支持早期版本的手机差距.我按照本教程解决了cordova 2.2和之前的冲突,现在已经解决了很多问题,但我仍然无法解决一些问题:
public PluginResult execute(String action, JSONArray optionsArr, String callBackId) {
alarm = new AlarmHelper(cordova.getActivity());
Log.d(PLUGIN_NAME, "Plugin execute called with action: " + action);
PluginResult result = null;
final AlarmOptions alarmOptions = new AlarmOptions();
alarmOptions.parseOptions(optionsArr);
Run Code Online (Sandbox Code Playgroud)
这个函数有这个问题:
public PluginResult execute(String action, JSONArray optionsArr, String callBackId)
Run Code Online (Sandbox Code Playgroud)
当我用这条线替换它时:
public boolean execute(String action, JSONArray optionsArr, CallbackContext callbackContext) {
Run Code Online (Sandbox Code Playgroud)
错误已修复,但此函数显示另一个错误:
persistAlarm(alarmId, optionsArr);
return this.add(daily, title, subTitle, ticker, alarmId, alarmOptions.getCal());
} else if (action.equalsIgnoreCase("cancel")) {
unpersistAlarm(alarmId);
return this.cancelNotification(alarmId);
} else if …Run Code Online (Sandbox Code Playgroud) android localnotification phonegap-plugins cordova cordova-2.0.0
我已经UIlocalNotification使用链接实现了方法
在我的应用程序中我的要求是
在通知提醒中,我们需要只有"Show me"按钮,默认情况下打开应用程序,
我们需要强制用户在通知时打开应用程序,因此通知警报中必须没有关闭按钮.
只有一个按钮也显示我必须打开应用程序
怎么样?
iphone objective-c ios localnotification uilocalnotification
以下是我想要处理Apple文档引用的情况.
作为所呈现的通知的结果,用户点击警报的动作按钮或点击(或点击)应用程序图标.如果点击操作按钮(在运行iOS的设备上),系统将启动应用程序,应用程序将调用其委托的应用程序:didFinishLaunchingWithOptions:method(如果已实现); 它传递通知有效负载(用于远程通知)或本地通知对象(用于本地通知).
如果在运行iOS的设备上轻触应用程序图标,则应用程序会调用相同的方法,但不会提供有关通知的信息.如果在运行OS X的计算机上单击应用程序图标,则应用程序将调用委托的applicationDidFinishLaunching:方法,其中委托可以获取远程通知负载.
如果没有关于通知的信息,我该如何处理这种情况?
notifications objective-c ios localnotification uilocalnotification
我正在使用cordova-plugin-local-notifications
插件.现在我有问题在Android和iOS上获取我的声音文件.
window.plugin.notification.local.add({
id: '0001',
date: new Date,
message: 'hello',
title: 'title',
badge: 1,
sound: 'www/resources/audio/beep.mp3',
autoCancel: true,
ongoing: true
});
Run Code Online (Sandbox Code Playgroud)
我需要做什么我需要在原生方面改变我的应用程序在sencha touch.
如何在上午 10:00 每 5 天重复一次 LocalNotification
我试试这个,但它不起作用
let content = UNMutableNotificationContent()
content.title = "Hello!"
content.body = "Hello_message_body"
content.sound = UNNotificationSound.default()
let futureTime = Date().addingTimeInterval(5 * 24 * 60 * 60)
var calendar = NSCalendar.current
calendar.timeZone = NSTimeZone.system
var components = calendar.dateComponents([.hour, .minute, .second], from: futureTime)
components.hour = 10
components.minute = 0
components.second = 0
let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true)
let request = UNNotificationRequest(identifier: "FiveDays", content: content, trigger: trigger)
let center = UNUserNotificationCenter.current()
center.add(request)
Run Code Online (Sandbox Code Playgroud) 我在我的颤振项目中尝试了颤振本地通知插件,它在简单的通知上工作正常,但我需要带有操作按钮的通知功能,请帮助我或建议我实现此功能。
我目前正在安排本地通知,如果用户当天尚未打开应用程序,则每天下午6点出现一次.如果用户已经加载了应用程序,那么我想取消当天的通知,并在明天下午6点安排新的通知.但是,当我尝试迭代计划通知列表(这不是我在应用程序中的唯一本地通知)时,通知会正确显示,[[UIApplication sharedApplication] scheduledLocalNotifications]数组始终为空.以下是给我带来麻烦的代码段:
// See if we need to create a local notification to tell the user that they can receive a daily reward
NSArray *notifications = [[UIApplication sharedApplication] scheduledLocalNotifications]; // <- This is always empty
// Iterate over all the pending notifications
for( int iter = 0; iter < [notifications count]; iter++ )
{
UILocalNotification* localNotification = [notifications objectAtIndex:iter];
if( [[localNotification.userInfo objectForKey:@"source"] isEqualToString:@"dailyReminder"] )
[[UIApplication sharedApplication] cancelLocalNotification:localNotification];
}
NSCalendar* calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
[calendar setTimeZone:[NSTimeZone localTimeZone]];
NSDateComponents …Run Code Online (Sandbox Code Playgroud) iphone objective-c ios localnotification uilocalnotification
从特定时间运行的后台打开我的应用程序..
我想做这样的事情
- (void)applicationDidEnterBackground:(UIApplication *)application
{
timer = [NSTimer scheduledTimerWithTimeInterval:10
target:self
selector:@selector(timerFired:)
userInfo:nil
repeats:NO];
}
- (void)timerFired:(NSTimer*)timer
{
NSLog( @"yes it is running...");
PickUpCallViewController *call=[[PickUpCallViewController alloc]initWithNibName:@"PickUpCallViewController" bundle:nil];
navi=[[UINavigationController alloc]initWithRootViewController:call];
[[navi navigationController] setNavigationBarHidden:YES animated:YES];
window.rootViewController = navi;
[window makeKeyAndVisible];
}
Run Code Online (Sandbox Code Playgroud) 我遵循https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/local-notifications中有关本地通知的文档。我实现了它并且工作得很好。现在我的场景是:用户输入Start Date,Repetition time和Number of Repetitions。我可能需要一些后台服务来调用此推送通知?有什么建议可以在设备中安排此操作吗?
更新
我从此链接添加了共享服务:https://www.c-sharpcorner.com/article/how-to-send-local-notification-with-repeat-interval-in-xamarin-forms/
现在我不'不知道如何停止Alarm Manager, UILocalNotification当我发送示例用户输入的发送 20 条通知时,20 条通知后必须停止。
ios ×7
objective-c ×5
android ×3
cordova ×2
iphone ×2
flutter ×1
ios4 ×1
sencha-touch ×1
swift ×1
xcode5 ×1