Cordova - Windows8 does not recognise navigator.notification.alert - windows-8

I am having a hard time getting cordova to work as I expect.
Here are the steps I have taken.
npm install -g cordova
md apps
cd apps
cordova create win8 com.win8.tryout win8tryout
cordova platform add windows8
In the www/js folder I edited the index.js adding
navigator.notification.alert('try me out');
to the device ready event.
Then I build the cordova project from the apps/win8 folder
cordova build
Then I opened the visual studio solution in the platforms/windows8 folder and ran the application.
The code fails at the navigator.notification.alert('try me out'); line with
"JavaScript runtime error: Unable to get property 'alert' of undefined or null reference"
I suspect that the build process isn't working correctly because the cordova.js file in the windows8/www directory is only 52kb and I was expecting a file of about 300kb.
Any ideas or suggestions would be appreciated.

Ok so a bit more research and I realised my sort comings.
From the documentation here:
"From version 3.0 onward, Cordova implements all device APIs as plugins..."
I had originally downloaded v2.9.1 which did not implement the plugin architecture.

Related

Is there some special environment for creating desktop app in react native

I was trying to make react native desktop app, I have never used it before its my first time experience and am facing errors I did tried to resolve them but couldnot, i did followed the instructions given on official website, error i am facing right now is:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.WindowsSDK.target
s(46,5): error MSB8036: The Windows SDK version 10.0.18362.0 was not found.
I installed the sdk but its not going and this is what i see on my terminal
Build failed with message Building Solution returned error code 1. Check your build configuration.
nailed it....!!!
I don't know why but the issue was with the target SDK version 10.0.18362.0...
I installed the latest version and now its working absolutely fine.....

How to use titanium inspector using titanium 5.2.2?

I am using Appcelerator titanium CLI to build ios app. I want to debug the app With Chrome DevTools but it seems like it's not compatible with the version which I have installed currently.
As per ti-inspector documentation, I have installed the node package by the below command.
npm install -g ti-inspector
So, When I tried this into my titanium project directory I am getting this response which is unexpected.
tn-inspector
Unexpected error: undefined
NOTE: titanium version - 5.2.2
Useful GitHub link: https://github.com/omorandi/TiInspector
Need help to understand or mitigate this issue. Thanks in advance!!!.
That repo is 5 years old and might not be compatible with the current SDK. You can use this instruction: https://docs.axway.com/bundle/Appcelerator_Studio_allOS_en/page/debugging_android_apps_with_3rd-party_tools.html to use the internal dev tools connection.

compile apk on a folder "Android" already created previously in react-native

I'm new to react-native, I've seen tutorials but everyone uses expo. I downloaded this project where they don't use expo. I want to compile this application for android, to finally get an .apk
This application already has a folder called "Android" but inside it does not have its respective .apk. How can I generate it?
this is the repository:
https://github.com/zsajjad/BusinessCard
It would be great if you can attach screenshots of how I should do it
Note. I have the latest version of android studio and I don't see the option of "build"
commands like "gradlew" from the console, they don't work, it's as if I didn't have that command installed
Following instructions for build apk using android studio
Hope you installed node and react native on your machine. If not
please follow the link to install it.Install node and react native
open your command prompt or terminal and redirect to your download project - cd /Businesscard Master (change it according to your project location)
Now enter - npm install
Enter - react-native link
Follow the android related linking instructions on following link react native camera
Hope you know about android camera and storage permissions.
same thing for react native text detector. Because your downloaded project have that packages in package.json
Now open your project android folder in android studio using open existing android project.
Then select build your project from android studio build menu and run it also
Generate apk using build menu- same process you have to follow for native android project
You don't need to use the CLI, that's needlessly complicated and it obscures what Android Studio is actually doing. Here's all you need to do.
Open the whole /Android/ folder in Android Studio. This is your "project" similar to how you open a *.xed file in XCode. Except in Android Studio, you just open up the whole folder to get the build.
Android Studio will now prepare your project using Gradle. If there are any errors in the preparation it will tell you about them. Assuming your gradle and Android Studio versions are compatible and you got no errors, you're now ready to emulate, debug and create a production build. At this point the workflow is similar to using XCode. You'll see emulators under Tools -> AVD Manager.
In the file menus go to Build->Generate APK. You can choose between signed APKs, debug APKs and so on. You'll need the key file if you're signing the APK on your computer, otherwise there's also Google Play signing after you upload the APK.
TL;DR: Just open your /Android/ folder in Android Studio.
Side note: When Android Studio gives you popups to upgrade stuff don't do it. NEVER upgrade Gradle or Android Studio unless the RN / Expo team specifically ask you. This will break your whole project and you will need to rebuild the platform.

A dummies guide to installing a PhoneGap plugin

I am trying to build a basic QR code scanning app but I am not exactly sure how to add a plugin. I am trying to install - https://www.npmjs.com/package/cordova-plugin-barcodescanner
I have installed NPM, GIT and Cordova, and have deployed a Framework 7 based app from the phonegap software that has the following directory:
C:\Users\user\Documents\Phonegap Apps\Saving Energy\Android
I am unsure how to install the plugin? Do I run
npm i cordova-plugin-barcodescanner
in Windows Command Prompt, and if so do I have to change the directory to my app plugin folder? Do I run it using node.js? Etc.
You can add plugin easily using cordova
you should open command prompt with Saving Energy as directory and run
cordova plugin add [cordova-plugin-name]
For your case it is
cordova plugin add cordova-plugin-barcodescanner
Hope it Helps!

Installing Sencha SDK and generating the GS app

I recently downloaded the Sencha SDK and the SDK tools. I installed the SDK tools, and unzipped the contents of the file sencha-touch-2.1.0-commercial.zip to my web server. I cd'd into the directory and ran the command given to generate a getting started app, but I received this message:
abe#Dubai:/var/www/sencha-touch-sdk$ sencha
[WARN] The current working directory (/var/www/sencha-touch-sdk) is not a recognized Sencha SDK or application folder. Running in backwards compatible mode.
Sencha Command v2.0.0 Beta 3
Copyright (c) 2012 Sencha Inc.
....followed by all the info on how to structure commands using sencha
I Googled it, and found out that one of the ways sencha knows that it's the sencha sdk folder is that it contains a hidden file called .sencha, which my sdk directory was missing. After creating a blank .senchasdk file, I ran the command again, but this time I got:
abe#Dubai:/var/www/sencha-touch-sdk$ sencha
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '/var/www/sencha-touch-sdk/command/sencha.js'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:40)
The interesting thing to me is that it's looking for a "command" directory which doesn't exist in my SDK folder. Did I download/extract the wrong thing? I followed the download link for the sdk that I got in my email from Sencha.
I'm using Ubuntu linux by the way. I hope this isn't as silly of a question as I think it is, I did my best to research the issue
EDIT: I just thought I'd add that I AM able to visit the sencha-touch-sdk directory in my browser and I do see the documentation. This leads me to believe that I have the right package after all...so once again I'm stumped.
Try using the Sencha CMD instead of Sencha SDK Tools for that Sencha SDK version.
Download the Sencha Command latest version then Install Sencha Command into the Bin folder of Sencha SDK tools.
Thereafter you just try by typing 'Sencha' in the command prompt.
**C:\Users\srinivasan.kk>sencha
Sencha Cmd v3.0.2.288**
Hope it helps you.