小编Jay*_*tra的帖子

如何在android中以编程方式从通知栏中删除通知?

任何人都知道我们如何以编程方式从应用程序中删除使用Pending intent调用的通知.

我曾经使用以下方法取消通知.

AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(Display.this, TwoAlarmService.class);
PendingIntent pi = PendingIntent.getBroadcast(Display.this, AlarmNumber, intent, PendingIntent.FLAG_CANCEL_CURRENT);
am.cancel(pi);
Run Code Online (Sandbox Code Playgroud)

但问题是已经解雇的通知没有从通知栏中删除.

提前致谢...

在此输入图像描述

notifications android android-notifications android-pendingintent

66
推荐指数
3
解决办法
6万
查看次数

UILocalNotification自定义声音不在iOS7中播放

我正在UILocalNotification申请中使用.

在应用程序中有两种声音有条件地播放 - 我已经为它们应用了适当的条件.

但是当我安装应用程序并在iOS 7设备上运行它时,它会触发本地通知,但声音不会在应用程序中播放.

下面给出了代码来设置通知:

    UILocalNotification *localNotification = [[UILocalNotification alloc] init];
    if (localNotification == nil)
        return;
    localNotification.fireDate = [pickerView date];

    localNotification.timeZone = [NSTimeZone defaultTimeZone];

    if (alarm_number == 1) {
        localNotification.alertBody = [NSString stringWithFormat:@"First Alarm"];
    }
    else
    {
        localNotification.alertBody = [NSString stringWithFormat:@"Second Alarm"];
    }

    localNotification.alertAction =@"Ok";

    NSString *message = [[NSString alloc]initWithString:@""];

    if(alarm_number == 1)
    {
        localNotification.soundName=@"Alarm_1.mp3";
        message = @"First Alarm Scheduled";
    }
    else
    {
        localNotification.soundName=@"Alarm_2.mp3";
        message = @"Second Alarm Scheduled";
    }

    localNotification.applicationIconBadgeNumber = 1;

    // …
Run Code Online (Sandbox Code Playgroud)

iphone audio ios uilocalnotification ios7

16
推荐指数
2
解决办法
1万
查看次数

XMPP iOS Framework检测OpenFire服务器的Internet断开问题

我已经使用XMPP iOS Framework和OpenFire服务器实现了聊天应用程序.

幸运的是,应用程序运行成功但我在应用程序中面临一个互联网断开问题.

当用户注销或手动进入离线模式时,它会向他/她的名单发送节.所以他/她的名单知道用户进入离线模式.

现在,当互联网将断开与用户设备的连接时,由于互联网断开连接,应用程序无法向服务器发送在线状态节.因此,他/她的名单将无法获得有关该离线用户的信息,用户将仅以在线模式显示.

我认为像OpenFire服务器这样的东西可能能够检查连接的用户,并且当任何用户断开连接时,它应该向他的名单发送具有离线状态的在线状态,以便他们知道该用户处于离线模式.

如果我能通过任何方式实现此功能,请有人帮助我.

解决这个问题对我很有帮助.

提前致谢.

sockets xmpp openfire ios xmppframework

10
推荐指数
1
解决办法
922
查看次数

如何在android中从URL启动android应用程序?

任何人都可以告诉我如何从android中的URL打开android应用程序.

我使用以下方法在Android中打开应用程序,但它不适合我.

<data android:scheme="application"/>
Run Code Online (Sandbox Code Playgroud)

我正在传递URL"application:// [RandomText]"的来源

这是打开应用程序的正确方法吗?

java url android

8
推荐指数
1
解决办法
2万
查看次数

如何在android中打印库项目的日志?

我有一个android项目,其中我已经包含3个其他的android库项目,我正在使用eclipse.我试图从库项目中打印日志,但它只打印主项目的日志.

那么任何机构都能告诉我如何打印主项目中包含的库项目日志吗?

我的主要项目是 com.project1.app,我在其中记录如下.

Log.i(TAG,"Log From Main Project1");
Run Code Online (Sandbox Code Playgroud)

图书馆项目com.subLibrary.subLibraryapp,我在其中记录如下.

Log.i(TAG,"Log From Main Library Project");
Run Code Online (Sandbox Code Playgroud)

但是在LogCat中,我只能看到com.project1.app如下所示的日志.

com.project1.app    |   Log From Main Project1
Run Code Online (Sandbox Code Playgroud)

我做错了或者我必须打开任何其他窗口,有人可以建议我吗?

android android-logcat

6
推荐指数
1
解决办法
2801
查看次数

如何在iOS中恢复NSOperationQueue的超时操作?

我已经在应用程序中成功实现了NSOperationQueue.

我有一个操作队列,可能有1000个NSOperations,如下所示.

@interface Operations : NSOperation

@end

@implementation Operations

- (void)main
{
    NSURL *url = [NSURL URLWithString:@"Your URL Here"];

    NSString *contentType = @"application/json";
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    [request setHTTPMethod:@"POST"];
    [request addValue:contentType forHTTPHeaderField: @"Content-Type"];
    NSError *err = nil;

    NSData *body = [NSJSONSerialization dataWithJSONObject:postVars options:NSJSONWritingPrettyPrinted error:&err];

    [request setHTTPBody:body];
    [request addValue:[NSString stringWithFormat:@"%lu", (unsigned long)body.length] forHTTPHeaderField: @"Content-Length"];

     [request setTimeoutInterval:60];

     NSHTTPURLResponse *response = nil;
     NSError *error = nil;

     NSData *resData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
}

@end
Run Code Online (Sandbox Code Playgroud)

现在,对于该队列,我一次添加所有1000个操作.我添加如下操作.

Operations *operation = [[Operations alloc]init];
[downloadQueue …
Run Code Online (Sandbox Code Playgroud)

synchronization nsoperation nsoperationqueue ios

6
推荐指数
1
解决办法
530
查看次数

如何使用 JavaScript 或 jQuery 截取 Google 地图的屏幕截图?

我想使用 JavaScript 在我的 html 文件中对谷歌地图进行“屏幕截图”。

地图当前正在加载div标签,因此我无法使用此<div>标签获取图像。

但是如果我可以在画布中加载它,<canvas>那么我可以很容易地截取它的屏幕截图,谁能告诉我这个问题的解决方案 - 也就是说,我如何在画布中加载谷歌地图。

或者是否有任何替代解决方案?

html javascript jquery canvas html2canvas

1
推荐指数
1
解决办法
1万
查看次数