nickiliev / nativescript-receiving-shared-content Goto Github PK
View Code? Open in Web Editor NEWPOC for implementing https://developer.android.com/training/sharing/receive#java
POC for implementing https://developer.android.com/training/sharing/receive#java
Hi, I'm so tired that I can't find a way to receive a CSV file. Is that impossible or what?
All I can get is content://the.sender.app.provider/internalCache/the-file-i-want-to-open.csv
Hi I'm using your implementation in nativescript-angular project.
and I want to use share and upload the shared images to my server.
How can I show the selected images in images slider, but there is exception that content://.......
URI is cannot be displayed.
Really learned a lot from this repo. Any chance to request an update to it now that app extensions are supported in nativescript?
As in title. The text is not received, but if I want to share some images, it's working. No errors..
Is there any plan for iOS implementation?
Hi all, here. I am running NS8 and just in case if someone runs into problems, here is example with correct imports.
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// var page_1 = require("@nativescript/core/ui").Page;
const Observable = require("@nativescript/core").Observable;
const application = require("@nativescript/core/application");
// sve gore dodano
import { Application } from '@nativescript/core'
import { HomeViewModel } from './home-view-model'
// dodano
var vm = new Observable();
export function onNavigatingTo(args) {
const page = args.object
page.bindingContext = new HomeViewModel()
// dole ubaceno
page.bindingContext = vm;
vm.set("sharedText", "testiram abc");
if (application.android) {
vm.set("sharedText", "Ovo je android!");
application.android.on(application.AndroidApplication.activityCreatedEvent, function (args) {
// application.android.on(application.AndroidApplication.startActivity., function (args) {
var activity = args.activity;
console.log("Pokrenuta aplikacija i ovo su podaci:");
console.log(activity);
vm.set("sharedText", "Stigli podaci");
// Get intent, action and MIME type
var intent = activity.getIntent();
var action = intent.getAction();
var type = intent.getType();
if (android.content.Intent.ACTION_SEND === action && type != null) {
if (type.startsWith("text/")) {
handleSendText(intent); // Handle text being sent
}
else if (type.startsWith("image/")) {
handleSendImage(intent); // Handle single image being sent
}
}
else if (android.content.Intent.ACTION_SEND_MULTIPLE === action && type != null) {
if (type.startsWith("image/")) {
handleSendMultipleImages(intent); // Handle multiple images being sent
}
}
else {
// Handle other intents, such as being started from the home screen
}
});
}
// gore ubaceno
}
// donje funkcije ubacene
function handleSendText(intent) {
if (application.android) {
var sharedText = intent.getStringExtra(android.content.Intent.EXTRA_TEXT);
if (sharedText != null) {
// Update UI to reflect text being shared
console.log("sharedText: ", sharedText);
console.log("Text received!");
// delay is needed to update UI after loading the app
setTimeout(func, 1000);
function func() {
vm.set("sharedText", sharedText);
}
}
}
}
function handleSendImage(intent) {
if (application.android) {
var imageUri = intent.getParcelableExtra(android.content.Intent.EXTRA_STREAM);
if (imageUri != null) {
// Update UI to reflect image being shared
console.log("Image received!");
var appContext = application.android.context;
var bitmap = android.provider.MediaStore.Images.Media.getBitmap(appContext.getContentResolver(), imageUri);
console.log("bitmap: ", bitmap);
vm.set("bitmap", bitmap);
}
}
}
function handleSendMultipleImages(intent) {
if (application.android) {
var imageUris = intent.getParcelableArrayListExtra(android.content.Intent.EXTRA_STREAM);
if (imageUris != null) {
// Update UI to reflect multiple images being shared
console.log("imageUris: ", imageUris);
console.log("Multiple images received!");
}
}
}
// gorenj funkcije ubacene
export function onDrawerButtonTap(args) {
const sideDrawer = Application.getRootView()
sideDrawer.showDrawer()
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.