Change device profile using phonegap / cordova - javascript

Iam using PhoneGap/Cordova + Backbone for developing a cross platform mobile application. Using phonegap i can access almost all the functions of the device. Is there somehow possible to access or change the device's profile using PhoneGap or using backbone ? I searched a lot but couldn't find any relevant results..!!
Is there any documentation available on this ?
Any help will be very much appreciated..!!

I didnt get what you means about "device's profile". You talking about accounts?
About Phonegap/Cordova you can do everything that a native app can. But sometimes you need to write a native plugin to interact with device. I already had to do that to do push notifications using a third lib.
You write a native class to do something, register it in plugins, give permissions and then call it with your javascript.
You can find documentation here: http://cordova.apache.org/docs/en/3.4.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide

Add this cordova plugin into your project.
https://github.com/apache/cordova-plugin-device
Put these line of codes into your view page
alert(device.cordova);
alert(device.model);
alert(device.name);
alert(device.platform);
alert(device.uuid);
alert(device.version);

Related

Nativescript core OCR plugin

I'm trying to develop an ocr app with the Nativescript plugin:
https://market.nativescript.org/plugins/nativescript-ocr
https://github.com/EddyVerbruggen/nativescript-ocr
and it seems that the example doesn't works or I'm doing something wrong. I read something about Firebase ML kit but I have no idea about that and if it works offline (Offline work is a must for me).
https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/master/docs/ML_KIT.md
Could be deprecated the first plugin?
might I use firebase?
could it use with nativescript core (only js)?
It works offline?
Any idea about how to start?
Yes, the OCR plugin is kind of deprecated, not actively maintained anymore.
Firebase ML-Kit is recommended and it has different methods you could use for text recognition, one works on device and another on cloud. Refer the same read me you have linked in your question.

How do I go about creating a javascript ipad app that uses local storage?

I need to create an internal admin app. The app needs to be able to:
For V1
- Wrap and execute javascript code
- Will not rely on any iOS code other than perhaps the code necessary to load the javascript.
- Uses local storage
For V2
- Work offline (which means javascript code needs to be loaded in)
Any ideas on how to go about implementing such a thing?
By far the easiest and best supported way is to use Apache Cordova. They did all the work of wrapping a Webview in a native app and have a rich set of plugins for integration with all kinds of mobile APIs.
Since the app will be running in an embedded browser you can simply access the normal Localstorage APIs.
The Cordova tutorial by #ccoenraets may be a good way to get started.
From my findings the following two are great solutions:
Ionic
Apache Cordova

Using ShareKit 2.0 in a HTML5 app

I'm developing a HTML5-based iOS app with PhoneGap. I'm using the latest version of PhoneGap 2.2.0. I want to include a share button, so users can share a message on Facebook and Twitter. I did some research and found my way to ShareKit 2.0. I actually managed to complete the necessary steps described on the wiki. My project is able to build successfully. :)
From here on I'm stuck. I can't find anything how to implement this in my JavaScript (jQuery) project. The old ShareKitPlugin describes a few steps, but it doesn't work. So I guess it changed since 2.0.
Is there another tutorial of some kind I can follow? Or is there another solution to include Facebook and Twitter share buttons? What I like about the ShareKit plugin is that it uses the native FB/Twitter apps installed on your phone (if I am correct assuming this).
Did you follow the steps on the "Adding the Plugin to the Project" section on phonegap plugin page?
If so, after adding the ShareKitPlugin.js import at your html file, like this:
<script src="ShareKitPlugin.js"></script>
you just need to call the share method, like this:
window.plugins.shareKit.share("text that will be shared", "http://google.com");

AngularJS + PhoneGap

I'm hopeful this issue has already been approached. Does PhoneGap work with AngularJS? Are there any limitations to using them together? Benefits/pitfals? Thanks
Yes.
I have made multiple applications with PhoneGap plus AngularJS. There's no magic to it.
PhoneGap just runs your application within the native device browser, so if AngularJS is supported on your target platforms, it should work with PhoneGap.
I'm having trouble getting angularjs working on windows phone 7 with phonegap. The simple stiff works, but as soon as I try to add page route...
[Edit]
Ok. So I have found the problem on windows phone 7/8.
in the function matchUrl(url,obj) in angular.js (1.0.3) there is a regex that fails because Windows Phone use an unusual prefix or namespace or whatever it is called (probably for security purposes).
What happens is angular is expecting a url like 'http://localhost/www/index.html' but in windows phone it will look like: 'x-wmapp0:www/index.html' instead.
I tried fixing the regex, but even so I get an error later on from XHR.
I've found that the brian t ford article (which everyone references) doesn't really explain how the config file is picked up (which includes the pointer to the index.html file and several other assets) which marks it out as a little out of date. It would be great to get a good update on it.
I am currently working on a project with Phonegap and AngularJS. I do recommend the following reading. Will help you decide if it's what you want in an hour.
http://briantford.com/blog/angular-phonegap.html
AngularJs will let you have the power and structure of a website but it has a small flaw is that it is a bit slow, I say this from experience and it happens that sometimes the models take a while to cool off.
Likewise, I recommend that you take a look at Yeomen, I am currently working on a generator angularJS phonegap and hope to have it for this weekend.
regards
#gartox
Yes. http://ionicframework.com is a framework that integrated Cordova and AngularJS. It will save you a lot of time trying to get everything set up.
To install the framework:
npm install -g cordova ionic
To create new empty:
ionic start myApp blank
All the options available in phonegap are also available in Ionic. For example, you could type
ionic serve
And your mobile app will open right in the browser, and auto-update whenever new changes are made to the files, just like in Phonegap.
From PhoneGap's blog:
http://phonegap.com/blog/2013/07/31/phonegap-30-faq/
Q: Does PhoneGap play well with angular.js? Or any other framework?
A: It sure does. PhoneGap does not dictate how an app gets authored with HTML, CSS, and JavaScript. We play nice with all frameworks and, of late, many are being authored today with Angular.

Creating and using iOS settings.bundle values with JavaScript in PhoneGap

Is it possible to create a section in the iPhone settings app, using PhoneGap (v1.4.1)?
I cannot find anything pertinent in the PhoneGap API.
My aim would be to use the user-set values in JavaScript.
I imagine that if PhoneGap does not currently have this functionality, it is possible to perform this task with a PhoneGap plugin.
Does anyone know of a current plugin that might enable Settings.bundle creation, and reading?
you can use applicationPreferences plugin https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/ApplicationPreferences

Categories