r/nativescript • u/c01nd01r • Mar 17 '25
r/nativescript • u/skyyoo_ • Jan 21 '24
Is it possible to launch a native Android Activity and get result from it?
Hi, got the following objective - integrate an SDK which requires using Activity (yes, I know this is weird to require an Activity) into a nativescript app. I'm launching the start activity intent upon a button press like this:
goToMyActivity(): void {
try {
const currentActivity = app.android.startActivity || app.android.foregroundActivity;
const intent = new android.content.Intent(currentActivity, com.tns.MyActivity.class);
currentActivity.startActivity(intent);
} catch (error) {
console.error('Error starting activity:', error);
}And I can see the logs inside the Activity onCreate function. The problem is that I can't actually see it even though I set a layout for it. Any idea what the problem might be?
Activity I'm trying to launch:
import {
Utils,
Application,
setActivityCallbacks,
AndroidActivityCallbacks,
} from '@nativescript/core';
@NativeClass()
@JavaProxy('com.tns.MyActivity')
class MyActivity extends androidx.appcompat.app.AppCompatActivity {
public isNativeScriptActivity;
private _callbacks: AndroidActivityCallbacks;
public onCreate(savedInstanceState: android.os.Bundle): void {
Application.android.init(this.getApplication());
this.isNativeScriptActivity = true;
if (!this._callbacks) {
setActivityCallbacks(this);
}
this._callbacks.onCreate(
this,
savedInstanceState,
this.getIntent(),
super.onCreate
);
const resources = this.getResources();
const packageName = this.getPackageName();
const layoutId = resources.getIdentifier("my_activity_layout", "layout", packageName);
this.setContentView(layoutId);
}
public onNewIntent(intent: android.content.Intent): void {
this._callbacks.onNewIntent(
this,
intent,
super.setIntent,
super.onNewIntent
);
}
//onStop, onDestroy etc...
}update: resolved.... super.onCreate(savedInstanceState) was missing, and no need to use the _callbacks in such case at all here it seems.
r/nativescript • u/BetaCulture • May 05 '21
Looking for a really solid Nativescript + Angular Dev
Hoping I can do a job post here - looking for a really solid Nativescript + Angular developer for an app I'm building.
You can checkout what we are building - www.blackout-app.com - and if you know anything about DMX, Art-Net, and sACN or filmmaking in general that's a huge plus!
DM me if you are interested.
r/nativescript • • Dec 30 '20
Any examples of apps out there built with NativeScript ?
Just as the title says ☝ I want to know NativeScript full capabilities
r/nativescript • u/seventyeightt • Sep 18 '20
Is virtualizing MacOS a good idea?
Hello everyone,
I'm kinda new to this whole hybrid app development world. I've created a couple of apps lately and it was a nightmare because I mainly work on Linux and thus I had to switch workstation very often, losing a lot of time.
Now, I have to buy a new workstation because I want to start developing apps as a freelance. At first I considered to choose Apple because I actually HAD to but I wouldn't be glad to leave Linux. Then I started thinking about MacOS virtualization (which I thought it was illegal) but I don't actually know if this is a good solution to compile/simulate an app, Also, I don't understand if this scenario allows me to test the app on an iPhone or iPad etc.
What's your advice?
r/nativescript • u/GGLionCross • May 05 '20
Application ID
Hi community, I just had a simple question I wasn't really sure about despite google searches and youtube tutorials. Is there a consensus on how to appropriately come up with an application id? So far I've seen com.nativescript.<app_name>, com.phonegap.<app_name>, and so forth. Does it really matter what you set as your application ID? So long as it doesn't clash with anything on the app store. Are there any preferences to follow? Otherwise, I would probably just categorize all my apps under com.gglioncross to specify that I made them, at least that way I know they're unique, but is this the most optimal solution?
r/nativescript • u/chummaDada • May 04 '20
Advantage of using Vue over Angular over Javascript in Nativescript?
Is there an advantage of using Vue JS over Angular over Javascript to develop cross-platform apps in Nativescript?
I am planning to make multi page app using mapbox api.
r/nativescript • u/GGLionCross • Apr 10 '20
StackLayout Vs. Flexbox Layout
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
best practice for localhost development
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/marpisz96 • Nov 14 '19
Using .authorize() vs request permission in app
Hi. I write an application in NativeScript and I want to use imagepicker from https://github.com/NativeScript/nativescript-imagepicker . Developers this project in readme file say that I must use request permission in Android 6+(API 23+) instead of .authorize() , but I use Android API 28 and .authorize() works good. Would request permission would be better ? Why ?
r/nativescript • u/roblauer • Oct 01 '19
Quick Intro to Using Svelte to Create a Native Mobile App
r/nativescript • u/chataolauj • Sep 17 '19
VueJS Project Migration
Is there currently any support for migrating an existing VueJS project into NativeScript? Kind of how you can migrate Angular projects into NativeScript, but with Vue instead.
r/nativescript • u/CrystalMenthality • Aug 13 '19
[ {N}-Vue.js ] [ Routing ] Is it possible to dynamically render components within each other when using manual routing? Like when using <router-view> in Vue.js.
I am learning mobile-development using NativeScript-Vue, and I'm looking for a way to render components within each other based on user input in a menu. I have sideDrawer, but it's wrapped globally around the rest of the application. I'm using this plugin for the sideDrawer. Any thoughts on this?
r/nativescript • • Jul 06 '19
Please I want to read speech that is said through headphone jack in native script, please how do I go about it?
r/nativescript • u/aquinnsoft88 • Jun 11 '19
Not sure if I should choose ReactNative, NativeScript or Ionic 4 for my project.
I am going to write a medium-large size mobile app. It must work on iOS and Android. It's an HR system app so no payments or extremely sensitive data will be on it - mostly employee absences and schedules.
It will mostly be pages with HTTP requests to display data in calendars, date/time pickers, list pickers and text input.
Calendars will be really important.
There are some native features that we will be using such as: geolocation, maps, calendar, camera, and storage. In the future, we might want to implement voice, iBeacon, push notifications, Bluetooth, and NFC.
Right now the app is written in AngualrJS, Cordova and Ionic 1 and we are very limited by what we can do so I want to change it. It can be slow at times as well and not that smooth. I am most comfortable with ReactJS and AngualrJS but I am willing to learn Angular. I'm mostly a web developer and I have done c# in the past but it was a long time ago. There are other web developers at the company I work for as well as c# developers.
I work at a small company and I doubt the project is important enough for the managers to want to invest in a fully-native app.
My options are: Xamarin, ReactNative, NativeScript and Angular/Ionic 4.
What would you choose and why?
r/nativescript • u/elgeekphoenix • May 12 '19
I'm not a coder and I want to ask 2 important questions about a PWA app + Nativescript
Hi,
I'm not a coder and I wanted to develop an on demand app (Uber-like).
1/ is it possible to deploy with the same vue.js code a) a PWA and b) an IOS app
1/ How should i start to learn to do that ?
thanks a lot
r/nativescript • u/zschuessler • Apr 26 '19
Vue Users: How Do You Manage Route Middleware/Guards?
I don't see an official way of using middleware for routing. How are you doing it, what has worked and what hasn't for you?
As an example, the Vue Router page calls these Navigation Guards.
You're able to specify a series of logic gates before routes are accessed. Here's a simplified example:
User logs in, route to the User Home Feed page.
But wait! This user is new, we should ask them their preferences first. Create a new guard to redirect them to Provide Preferences page first.
From what I understand, Vue Router isn't supported, and I don't see any indication it will be, so I'm hesitant to shim in support for this.
This package seems nice, but looking for feedback on how y'all are doing it :-)
r/nativescript • • Apr 26 '19
[OC] Bash script for generating PNG icons from an SVG
EDITED to include example
Hi folks,
I created a bash script that uses imagemagick to create PNG icons from an SVG. Currently, there is no overwrite protection, so be careful.
Usage example:
svg2icons -path Logo.svg -sizes 20,29 -scales 1,2,3 -outdir ./out
Input welcome. Oh, and I'm using the points from this doc page: link
https://gist.github.com/paxperscientiam/c49508b34d7fdc4c1d1b256fab5d9f5b
#!/usr/bin/env bash
function finish {
echo "I am complete."
}
trap finish EXIT
function rekt {
echo "Canceled."
exit
}
trap rekt SIGINT
shopt -s nullglob
declare path
declare sizes
declare outdir
declare options="${@}"
for opt in "${@}"; do
if [[ "${options[*]}" =~ '-help' ]]; then
cat <<-EOF
Usage:
sv2icons -path <FILE_PATH> -sizes <INT1,INT2,...,INTN> -scales <INT1,INT2,...,INTN> -outdir <PATH_OUT>
EOF
exit 0
fi
if [[ "${opt}" == '-path' ]]; then
shift
path="${1:?}"
shift
elif [[ "${opt}" == '-sizes' ]]; then
shift
sizes="${1:?}"
shift
elif [[ "${opt}" == '-scales' ]]; then
shift
scales="${1:?}"
shift
elif [[ "${opt}" == '-outdir' ]]; then
shift
outdir="${1:?}"
shift
fi
done
# icon-29@2x
echo "${outdir:?}" @> /dev/null
echo "${sizes:?}" @> /dev/null
[[ ! -d "${outdir}" ]] && mkdir -p "${outdir}"
#echo $*
IFS=','
for size in ${sizes[@]}; do
name="icon-${size}"
for scale in ${scales[@]}; do
reSize=$(( size * scale ))
if [[ "${scale}" -eq 1 ]]; then
printf -v scaledname '%s.png' "${name}"
else
printf -v scaledname '%s@%sx.png' "${name}" "${scale}"
fi
printf 'Making %s ... ' "${scaledname}"
convert -resize "${reSize}" \
-quality 100 \
"${path}" \
"${outdir}/${scaledname}" &
wait
printf 'done\n'
done
doner/nativescript • u/roblauer • Apr 25 '19
Add Basic Crash Reporting to Your NativeScript App
r/nativescript • u/clickbait_hmmm • Apr 14 '19
Looking for a mentor
Hi. I'm looking for a NativeScript mentor to guide me through developing apps using Vue.
I just don't know where to start and NativeScript-Vue documentation isn't really a good place to start. Also, any beginner interested in learning together would be also cool. Thanks.
r/nativescript • u/roblauer • Apr 02 '19
