cordova - iOS Developer: Show station name on lock screen -
so quick rundown, using cordova , edited mainviewcontroller allow audio play in background , controls work, show station image on front (like album cover guess say)
the image stored in app self (if possible) otherwise guess can put on server , ping image each time - ever easier @ end of day.
i wondering how this? great
my current mainviewcontroller
/* licensed apache software foundation (asf) under 1 or more contributor license agreements. see notice file distributed work additional information regarding copyright ownership. asf licenses file under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license @ http://www.apache.org/licenses/license-2.0 unless required applicable law or agreed in writing, software distributed under license distributed on "as is" basis, without warranties or conditions of kind, either express or implied. see license specific language governing permissions , limitations under license. */ // // mainviewcontroller.h // hellocordova // // created ___fullusername___ on ___date___. // copyright ___organizationname___ ___year___. rights reserved. // #import "mainviewcontroller.h" #import <avfoundation/avfoundation.h> @implementation mainviewcontroller /*- (id)initwithnibname:(nsstring*)nibnameornil bundle:(nsbundle*)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // uncomment override cdvcommanddelegateimpl used // _commanddelegate = [[maincommanddelegate alloc] initwithviewcontroller:self]; // uncomment override cdvcommandqueue used // _commandqueue = [[maincommandqueue alloc] initwithviewcontroller:self]; } return self; }*/ - (id) initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization nserror *setcategoryerror = nil; [[avaudiosession sharedinstance] setcategory: avaudiosessioncategoryplayback error: &setcategoryerror]; } return self; } - (id)init { self = [super init]; if (self) { // uncomment override cdvcommanddelegateimpl used // _commanddelegate = [[maincommanddelegate alloc] initwithviewcontroller:self]; // uncomment override cdvcommandqueue used // _commandqueue = [[maincommandqueue alloc] initwithviewcontroller:self]; } return self; } - (void)didreceivememorywarning { // releases view if doesn't have superview. [super didreceivememorywarning]; // release cached data, images, etc aren't in use. } #pragma mark view lifecycle - (void)viewwillappear:(bool)animated { // view defaults full size. if want customize view's size, or subviews (e.g. webview), // can here. [super viewwillappear:animated]; } - (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. } - (void)viewdidunload { [super viewdidunload]; // release retained subviews of main view. // e.g. self.myoutlet = nil; } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // return yes supported orientations return [super shouldautorotatetointerfaceorientation:interfaceorientation]; } /* comment out block below over-ride */ /* - (uiwebview*) newcordovaviewwithframe:(cgrect)bounds { return[super newcordovaviewwithframe:bounds]; } */ #pragma mark uiwebdelegate implementation - (void)webviewdidfinishload:(uiwebview*)thewebview { // black base color background matches native apps thewebview.backgroundcolor = [uicolor blackcolor]; return [super webviewdidfinishload:thewebview]; } /* comment out block below over-ride */ /* - (void) webviewdidstartload:(uiwebview*)thewebview { return [super webviewdidstartload:thewebview]; } - (void) webview:(uiwebview*)thewebview didfailloadwitherror:(nserror*)error { return [super webview:thewebview didfailloadwitherror:error]; } - (bool) webview:(uiwebview*)thewebview shouldstartloadwithrequest:(nsurlrequest*)request navigationtype:(uiwebviewnavigationtype)navigationtype { return [super webview:thewebview shouldstartloadwithrequest:request navigationtype:navigationtype]; } */ - (void) viewdidappear: (bool) animated { [super viewdidappear:animated]; [[uiapplication sharedapplication] beginreceivingremotecontrolevents]; [self becomefirstresponder]; } - (bool) canbecomefirstresponder { return yes; } - (void) remotecontrolreceivedwithevent: (uievent*) event { // see [event subtype] details } @end @implementation maincommanddelegate /* override methods, uncomment line in init function(s) in mainviewcontroller.m */ #pragma mark cdvcommanddelegate implementation - (id)getcommandinstance:(nsstring*)classname { return [super getcommandinstance:classname]; } /* note: inspect execute calls coming explicitly native plugins, not commandqueue (from javascript). see execute calls javascript, see maincommandqueue below */ - (bool)execute:(cdvinvokedurlcommand*)command { return [super execute:command]; } - (nsstring*)pathforresource:(nsstring*)resourcepath; { return [super pathforresource:resourcepath]; } @end @implementation maincommandqueue /* override, uncomment line in init function(s) in mainviewcontroller.m */ - (bool)execute:(cdvinvokedurlcommand*)command { return [super execute:command]; } @end
side note, used node.js create using there cordova install
Comments
Post a Comment