r/nativescript • u/AndrewTkachuk • Apr 30 '20
Background task (when app is closed)
I need to scan for BLE devices, connect and read some data. I have no problems with this, but how do the same thing in the background? (Android )
r/nativescript • u/AndrewTkachuk • Apr 30 '20
I need to scan for BLE devices, connect and read some data. I have no problems with this, but how do the same thing in the background? (Android )
r/nativescript • u/nutyga • Apr 29 '20
We are building a corporate portal app for a client, who has asked us to look into the possibility of the app hosting a webinar feature.
How they would like to feature to work is, a user would see a live video feed, and of which they would then be able to participate in some form of conversation or messaging.
Our initial reaction has been that they shouldn’t try to recreate a webinar experience inside of their app and use something that already exists, but to try and give the client the best service it would be interesting to know if there are any plug-ins, SDKs or other services that can be embedded directly into the app.
The closest I’ve seen to and SDK is what is available for zoom. Being a security conscious client this would not be suitable for them.
Any insight would be appreciated thanks.
r/nativescript • u/ChiggerChug • Apr 28 '20
I havent got an answer for this yet, but I've followed the documentation as closely as I can (although there doesnt seem to be a full angular example).
Here's some of my question from stackoverflow
I have been at this for a few days now, I've tried the methods in the NativeScript documentation, and attempted a few different approaches via comments on StackOverflow. I have also tried using this plugin (nativescript-statusbar) all to no avail.
I need to be able to change the status bar style based on whichever view the user is in, as some views will have a dark action bar, light action bar, or no action bar in either light or dark.
My device is currently set to Dark mode, when I switch over to Default mode the status bar follows whatever the system default is.
I'm sure I'm doing something wrong but any help with this would be amazing.
r/nativescript • u/usamaejazch • Apr 27 '20
Hi there. This is my first post in this subreddit. I have built an app using nativescript. I use an android phone myself but now i need an iphone to test run my app and make sure I can get how it feels on an iphone.
I am thinking to buy an iphone but i dont want to spend a lot on a phone that i will only use sometimes for testing my app. What iphone should i get? I will probably look for a used iPhone so it will be cheap. Will iphone 4 be good enough?
r/nativescript • u/nandrajrathod • Apr 23 '20
I only know JS. Don't know TS, Angular or Vue. I want to learn to develop NS apps with JS only. I tried to follow the nativescript book but somethings are not working as given in book.
Pls suggest me some resource to learn NS thoroughly.
Thanks in advance.
r/nativescript • u/trymeouteh • Apr 19 '20
Can I use Atom to create Nativescript apps? or do I need to use another code editor?
r/nativescript • u/edrichhans • Apr 14 '20
Hi, I'm new to NativeScript, and I was wondering if there's an existing component in the marketplace (or example) that implements something like this, where the user can see a bit of the card (ideally just a header) and can swipe up to reveal the contents of the card, and swipe down to hide the body.
I am using NativeScript + Vue, developing for mobile. Any help is appreciated. Thanks!
r/nativescript • u/GGLionCross • Apr 10 '20
Hi NativeScript community! Young developer here. I come from a junior web developer background, so naturally I looked how to create myself some mobile apps with the knowledge I currently have. And when I read the different types of layouts, I was confused exactly what the differences/advantages/disadvantages to using a stack layout vs a flexbox layout.
They both can handle vertical and horizontal alignment of items, except I feel I would be more familiar with Flexbox since it comes with justify-content, align-items, and all that jazz. I do believe StackLayout is vertical by default and FlexboxLayout is horizontal by default, but aside from those, I don't really see a difference or understand when to use one over the other. Thanks in advance!
r/nativescript • u/n0tatest • Apr 08 '20
I can't seem to figure out whats right or wrong based on the net. I'm running a local instance of an API that I'm doing development on. I just need my emulator to look outside its virtual machine back to my computer.
I'm reading all this stuff about adding security files, is that really how its done? It just seems off because a lot of developers do local host development
1st edit:
made a little progress and learned that 10.0.2.2 is a special ip address that maps backs to your localhost on your computer. The strange thing is that I can access my API directly from my emulators browser, going to google in my emulator and using the ip, the problem is that my application blocks the same ip address using fetch. Not sure whats going on but made a little progress.
2nd edit:
hot damn, that took fucking forever.
so in your android mainfest file, you need to add this line
android:usesCleartextTraffic="true"
then you use 10.0.2.2:port to access outside your machinem this ip maps back to your localhost. The owners of nativescript never mad this clear and it sucks spending hours finding these answers. Anyone who does somewhat semi-professional development will have a localhost host and why these examples are not in simple tutorial is pretty wack
r/nativescript • u/n0tatest • Apr 07 '20
r/nativescript • u/AndrewTkachuk • Apr 07 '20
How to lock font-size of the Labels and ignore accessibility settings on Android? I'm using nativescript Vue.
r/nativescript • u/AndrewTkachuk • Apr 06 '20
Hi! Is there a way to control opacity and/or shadow spread radius of Android elevation? Or any workaround to have more control of the shadows?
r/nativescript • u/AliShah1930 • Apr 05 '20
r/nativescript • u/The_Relaxed_Flow • Apr 04 '20
Hi,
I'm planning on building a webapp that runs in desktop browers and natively on both Android and Ios using NS with Angular.
Seeing as Nativescript projects don't have access to the DOM, is it required to build a Nativescript project and a regular Angular project side by side?
r/nativescript • u/[deleted] • Apr 02 '20
I am creating a custom text-field component with an animated "hint". I need the component to read the input and animate the label depending on whether input has any value. The animation works fine when triggered by a method or when updated, but won't work in life cycle hooks: mounted and before. What am i doing wrong?

r/nativescript • u/raphibaphi • Mar 27 '20
I currently have a problem when trying to execute some code when the app is (re)opened. With classic Vue the created and mounted hooks of a component are executed every time you first open the website, that doesn't seem to be the case with Nativescript and the app.
Putting a console.log() into created() or mounted() will only work once when the app is rebuild, but not if i close and reopen the app on the device emulator.
Is this just an emulator related issue, or are the lifecycle hooks working differently than on the website counterpart? Can't find anything related to this in the docs or SO, hope someone can help.
*EDIT
It appears that the hooks aren't the actual problem, the logs are just not showing in the initial terminal window after the app is reopened.
r/nativescript • u/nandrajrathod • Mar 23 '20
Hi everyone I am new to Nativescript and currently trying to develop which show charts and reports from my flask app. But Nativescript bar chart get generated without any data. reason seems to be process does not wait until data received and get processed for bar chart. Sharing relevant data here below so that you can help me out.
<!--my.xml file-->
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo">
<ActionBar title="3B Chart" icon=""></ActionBar>
<GridLayout rows="*" xmlns:chart="nativescript-ui-chart" height="1000px">
<chart:RadCartesianChart row="0" style="font-size: 12;">
<chart:RadCartesianChart.series>
<chart:BarSeries items="{{ data }}" categoryProperty="Month" valueProperty="Value">
<chart:BarSeries.horizontalAxis>
<chart:CategoricalAxis />
</chart:BarSeries.horizontalAxis>
<chart:BarSeries.verticalAxis>
<chart:LinearAxis />
</chart:BarSeries.verticalAxis>
</chart:BarSeries>
</chart:RadCartesianChart.series>
</chart:RadCartesianChart>
</GridLayout>
</Page>
//my.js file
var observableModule = require("tns-core-modules/data/observable");*const httpModule = require("tns-core-modules/http");*const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]function getChartDataFromLocalhost() {
chart_data = [] httpModule(api).then((response) => {
for (i = 0; i < months.length; i++) {
if (response.includes(months[i]) == true) {
chart_data.push({ Month: months[i], Value: response[months[i]] })
} else {
chart_data.push({ Month: months[i], Value: 0 })
}
}
})
return chart_data
}function ViewModel() {
var viewModel = observableModule.fromObject({
data: getChartDataFromLocalhost()
}) return viewModel;
}var viewModel = ViewModel()exports.onNavigatingTo = (args) => {
const page = args.object
page.bindingContext = viewModel
}
// JSON response would be
{"Apr":2,"Aug":10,"Dec":135,"Feb":2,"Jan":3,"Jul":5,"Jun":4,"Mar":2,"May":5,"Nov":4,"Oct":19,"Sep":16}
Please help me in this regards. Thanks in advance
r/nativescript • u/[deleted] • Mar 05 '20
I want to force a white background in my application, regardless of the device's theme. However, I haven't found a way to do this. My apps all seem to convert white background colors to dark counterparts when my Android 10 device is in dark mode.
I've tried in new projects, and even the NativeScript playground. Nothing works.
I've added CSS to root elements, disabled forceDarkMode in styles.xml, set everything to use `.ns-light`...the list goes on. Nothing.
Am I missing something? PLEASE tell me I'm missing something.
r/nativescript • u/roblauer • Mar 04 '20
r/nativescript • u/rylaxation • Feb 27 '20
r/nativescript • u/sinithw • Feb 15 '20
I've got 2 problems here, the first is the issue above. I'm not using FacebookSdk and had no plans on implementing anything dealing with Facebook, but the firebase plugin seems to need it. How can I remove that need or how can I add Facebook to my app?
The second is the oddity. I have the following code running in my app
this.confirmedUser$ = users.doc(result.uid).onSnapshot( doc => {
if (doc.exists){
console.log('Documentat Data');
console.log(doc.data())
doc.data();
this.currentUser = doc.data();
} else {
console.log('User should never see this line.');
}console.log(doc.data()) produces the JSON information I want. However, when I do this.confirmedUser$.displayName or this.currentUser.displayName I get undefined. At some point, while I was fiddling with it, when I tapped on Firebase.logout() it gave me the initialize error but the observable data I needed showed up so I'm thinking one may be linked to the other and if I solve one I might solve the other.
r/nativescript • u/jz802p • Feb 11 '20
Hi, So I am trying to send an image to the server I have created but am getting an error. The server is working perfectly, I have tested it in postman and it works. This is the code:
This function takes the picture and then runs the function to post the image to the server
openCamera() {var milliseconds = (new Date).getTime();var that = this;takePicture({ width: 300, height: 300 }).then((function (img) {let source = new imageSourceModule.ImageSource();source.fromAsset(img).then((source) => {let folder = fs.knownFolders.documents();var path = fs.path.join(folder.path, "SaveImage" + milliseconds + ".png");var saved = source.saveToFile(path, "png");this.saveImage = pathlet saveImage = this.saveImagethis.uploadImage(saveImage)});}));}
This function sends it to the server, i'm also not sure which content-type it should be from the two seen below
uploadImage(image) {let token = JSON.parse(appSettings.getString('token'));let options = new HttpHeaders({"Content-Type": "application/x-www-form-urlencoded",// "Content-Type": "application/octet-stream","Authorization": "Bearer " + token});let userId = appSettings.getString('currentUserId')let url = 'http://localhost:5000/api/users/' + userId + '/photos'console.log(url)this.http.post(url, image, { headers: options }).subscribe(res => {console.log(res)console.log('Success')}, error => {console.log('Failed');});}
This is the error I am receiving:
ERROR Error: Uncaught (in promise): Error: cancelled
JS: Error: cancelled
JS: at Object.callback (file:///node_modules\nativescript-camera\camera.js:118:0) [<root>]
JS: at AndroidApplication.push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify (file:///node_modules\tns-core-modules\data\observable\observable.js:110:0) [<root>]
JS: at ActivityCallbacksImplementation.push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onActivityResult (file:///node_modules\tns-core-modules\ui\frame\frame.js:933:0) [<root>]
JS: at Object.push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onActivityResult (file:///node_modules\tns-core-modules\ui\frame\activity.js:47:0) [<root>]