facebook

Sound notification or vibrate?: native app only

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #323805 Reply

    Yann
    Member

    Hello,
    when my app is launched i send a request to remote server to verify something.
    if remote server response is true i would like play a system sound like a sms or a vibration.
    is it possible without phone gap?
    otherwise have you an simple example of phonegap to play a sound and/ or vibrate ?
    i tried to import phonegap.js and add
    navigator.notification.vibrate(2000);
    to my js file but nothing happen
    thanks
    Yann

    #323821

    support-michael
    Keymaster

    Hi Yann,

    > i would like play a system sound like a sms or a vibration. is it possible without phone gap?

    I am not aware of how a webapp can notify a user of completion of a task using sound or vibration. Your server could send your device an sms or email msg.

    From a native app only (not webapp) the phonegap/cordova notification api can be used to play a beep wav file or vibrate the device. I created a simple app with a button that calls the notification.vibrate() function.

    Note: Don’t include phonegap.js as there are different versions and I doubt they are compatible across versions. The appcenter builder will automatically include a phonegap.js library into the project during build time.
    See attachment vibrate-ss.png
    See attachment vibrate.mobi

    Attachments:
    You must be logged in to view attached files.
    #323822

    Yann
    Member

    Thanks a lot Wayne,
    from js custom file i send a xmlHttpRequest to my remote server
    if responseText==”true” i play a sound

    :o)

    #323831

    Albatros78
    Participant

    Very nice Wayne.

    But I receive following error many times (MB1 1.4.2)

    java.lang.RuntimeException: Failed to compile JS
    at com.genuitec.mobione.codegen.processors.HTMLExporterData.exportJSString(HTMLExporterData.java:841)
    at com.genuitec.mobione.codegen.HTMLExporter.generateHTML(HTMLExporter.java:715)
    at com.genuitec.mobione.codegen.HTMLExporter.exportForm(HTMLExporter.java:287)
    at com.genuitec.mobione.designer.export.ExportManager.exportHTML(ExportManager.java:265)
    at com.genuitec.mobione.designer.export.ExportManager.exportHTML(ExportManager.java:235)
    at com.genuitec.mobione.designer.action.RunEmulatorAction$2.run(RunEmulatorAction.java:48)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
    Caused by: java.lang.RuntimeException: Failed to compile JS
    at com.genuitec.mobione.codegen.processors.HTMLExporterData$7$1.doOutput(HTMLExporterData.java:832)
    at com.genuitec.mobione.codegen.render.TempBuffer.doOutput(TempBuffer.java:32)
    at com.genuitec.mobione.codegen.processors.HTMLExporterData$7.doInput(HTMLExporterData.java:824)
    at com.genuitec.mobione.codegen.render.TempBuffer.doInput(TempBuffer.java:45)
    at com.genuitec.mobione.codegen.processors.HTMLExporterData.exportJSString(HTMLExporterData.java:821)
    … 6 more
    Caused by: java.lang.RuntimeException: Closure compiler process returned 1
    at com.genuitec.mobione.codegen.processors.HTMLExporterData.runClosureCompiler(HTMLExporterData.java:891)
    at com.genuitec.mobione.codegen.processors.HTMLExporterData$7$1.doOutput(HTMLExporterData.java:830)
    … 10 more

    And when the compilation works, my iphone doesn’t vibrate (3GS iOS 3.1.3) !!!

    Regards

    #323834

    support-michael
    Keymaster

    @Albatros78

    For the compilation problem can you send your mobione log file? It is found at <yourhomedir>\.mobione\runtime\.metadata\.log

    >my iphone doesn’t vibrate (3GS iOS 3.1.3) !!!
    We have seen a few problems with phonegap running on older versions of iOS. I believe our oldest system in the lab is at 3.2.x.

    #323836

    Albatros78
    Participant

    log file is here

    Attachments:
    You must be logged in to view attached files.
    #323866

    support-michael
    Keymaster

    @Albatros78

    I have opened a bug for the dev team to investigate why the code-gen failures. I suspect it will be a memory problem but can’t be sure yet.

    #323867

    Albatros78
    Participant

    I have 4 Gb on my PC and probably 1Gb or 1,4 Gb of free ram when MB1 was running.

    ???

    #323872

    support-michael
    Keymaster

    @Albatros78

    Thanks for that info. I will discuss w/ the dev team. It may be more than memory since this error signature is different from classic OOM errors. Here is a question is the problem intermittent? For example if you run code-gen and it fails, can you immediately run another code-gen action with success? Or does once it fail always fail?

    Do you make any changes that causes code-gen to succeed after it has failed?

    Also do only certain type of apps fail such as your graphing app that uses 3rd party library or apps that you have customized the javascript? Or do all apps fail code-gen such as a simple helloworld design?

    All info is helpful in tracking down these type of matters.

    Thanks for your patience!!!

    #323873

    Albatros78
    Participant

    Hi Wayne,

    Yes it was intermittent with the source code. I tried this morning and compilation works fine at each tim e!!!
    I cannot reproduce it today.. (no reboot of my PC) and no change.

    Maybe some previous bad code always into memory before a memory refresh.
    Yes I worked with JS code for my charts before (during the day)

    I don’t know exactly

    If I have others crashes obvsiously I will send you log files.

    Thanks for your help
    Regards

    #323908

    Albatros78
    Participant

    Hello Wayne,

    Which version of Phonegap is emulated by MB1 ? 1.4.1 ?

    Need to check wich iOS version is supported for phonegap API.
    with 1.4.1 seems iOS 4.0 is the minimum.

    Hello everybody
    Does one of you has running this example on iOS 3.x ? if yes, which exact iOS version?

    Thanks

    #324317

    Max87
    Member

    Hello,
    I tried this example on iPhone 4, iOS 5.01 and when I run it on Mobile Safari or add to homescreen, it doesn’t work.

    #329083

    Max87
    Member

    Hi guys,
    I succesfully implemented this function to my project, but I’ve found a problem – I have set to beep every second when timer goes bellow 5sec of remaining time(in my app – game, as a notification). But it beeps even if Mute switch on iPhone is set to Mute.
    Can you guys help me, how to know mute switch state?
    Thanks for help.

    #333167

    Unknown Author
    Participant

    I’m also having issues with vibration. I cannot get it to vibrate more than once. My application requirement: Vibrate at a user-selected time interval until a button is pressed to stop the vibration. The iphone 4 will not vibrate more than once.
    -1TC

    #333344

    support-michael
    Keymaster

    See this example project I posted on the How-To/Examples forum that demonstrates device vibration at user defined interval (seconds).

    http://www.genuitec.com/support-genuitec/viewtopic.php?f=14&t=4600

Viewing 15 posts - 1 through 15 (of 15 total)
Reply To: Sound notification or vibrate?: native app only

You must be logged in to post in the forum log in