Skip to content

Instantly share code, notes, and snippets.

View RameshAran's full-sized avatar

Arangott Ramesh Chandran RameshAran

View GitHub Profile
@RameshAran
RameshAran / gist:fd45a924eb4679390e8397cc8b11b813
Last active October 17, 2021 18:01
Battery Historian Command Line samples
docker run -p 4545:9999 gcr.io/android-battery-historian/stable:3.0 --port 9999
let image = UIImage(assetIdentifier: .ImageIconOne)!
let imageNameOne = "icon_image_1"
let image1 = UIImage(named: imageNameOne)!
//UIImage accepts any string
let image2 = UIImage(named: NSFileHandleNotificationFileHandleItem)!
let image1 = UIImage(named: "icon_image_1")!
let image2 = UIImage(named: "icon_image_2")!
let image3 = UIImage(named: "icon_image_3")!
import UIKit
enum AssetIdentifier: String {
case ImageIconOne = "icon_image_1"
case ImageIconTwo = "icon_image_2"
case ImageIconThree = "icon_image_3"
}
extension UIImage {
import Foundation
class SessionManager {
public static let sharedInstance = SessionManager()
let dataManager: StoreDataManager
private init() {
self.dataManager = StoreDataManager()
}
let content = UNMutableNotificationContent()
content.title = NSString.localizedUserNotificationString(forKey: "Hello!", arguments: nil)
content.body = NSString.localizedUserNotificationString(forKey: "Hello_message_body", arguments: nil)
content.sound = UNNotificationSound.default()
// Deliver the notification in five seconds.
let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false)
let request = UNNotificationRequest.init(identifier: "notification_sample_2", content: content, trigger: trigger)
// Schedule the notification.
UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
content.title = [NSString localizedUserNotificationStringForKey:@"Hello!"
arguments:nil];
content.body = [NSString localizedUserNotificationStringForKey:@"Hello_message_body"
arguments:nil];
content.sound = [UNNotificationSound defaultSound];
UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:5
let center = UNUserNotificationCenter.currentNotificationCenter()
center.requestAuthorizationWithOptions([.Alert, .Sound]) { (granted, error) in
// Enable or disable features based on authorization.
}
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound)
completionHandler:^(BOOL granted, NSError * _Nullable error) {
// Enable or disable features based on authorization.
}];