How to save iphone screen in Phonegap 1.0?

I am trying to save the iphone screen while my application is running. I followed this post: phonegap, iphone and big bad idleTimerDisabled

and did something similar in PhoneGapDelegate.m:

-(BOOL)application:(UIApplication *)application
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // existing code ...
  application.idleTimerDisabled = YES; // I added this line
  return YES;   // existing code
}

but it didn’t work.

I also tried this approach: http://groups.google.com/group/phonegap/browse_thread/thread/5eeace5c416719ec/d7180ef5a3a9081d?lnk=gst&q=lock#d7180ef5a3a9081d but this also did not work.

Can someone give me some suggestions? Thank!

UPDATE: Thanks everyone! It turns out I'm changing the wrong fil (PhoneGapDelegate.m). The applicationdidfinishlaunching method in this file is never called. The file to be modified is AppDlegate.m.

+5
3

: iOS: ? , , :

-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
    [application setIdleTimerDisabled:YES];
    return YES;
}

, return YES;, , .

Apple :

:. , reset , . , . . , . , , , .


: Phonegap, iphone - applicationDidFinishLaunching, PhoneGap - Xcode.

, , :

- (void)applicationDidFinishLaunching:(UIApplication *)application {
    [application setIdleTimerDisabled:YES];
}
+1

phonegap github

reset "idletimerdisabled" .js. , , Android.

+2

:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    NSArray *keyArray = [launchOptions allKeys];
    if ([launchOptions objectForKey:[keyArray objectAtIndex:0]]!=nil) 
    {
        NSURL *url = [launchOptions objectForKey:[keyArray objectAtIndex:0]];
        self.invokeString = [url absoluteString];
    }

    application.idleTimerDisabled = NO;
    application.idleTimerDisabled = YES;

    return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
0

All Articles