TransWikia.com

How to log android with network user's credential?

Stack Overflow Asked by Elgate on December 11, 2021

I am trying to save files to the shared folders on the network. These androids do not have sim cards. The problem I have is a permission denied to write in the folder. But I do not know how to add devices to the shared network. How should I go about givin permission to these devices?

Can I create a single user for all of them and use it? Or do I have to create a separate user for each devices?

In the possibility it’s my code that’s wrong, I’ll post the relevant part. Note that I can confirm I am connected to the network.

string basePath = @"\NascldShareDeliveriesPictures";
Directory.CreateDirectory(basePath);
string path = $@"{piece}.jpg";
File.WriteAllBytes(path, image);

piece is a decimal and image is a byte[].
Whenever i try to access the folder, I get a "read only" folder, but it’s not readonly. I belive it’s a lack of permission.

Thank you for the help and have a nice day

One Answer

I ended up using sharpcif.

try
{
    SharpCifs.Config.SetProperty("jcifs.smb.client.lport", "8080");

    //Get Auth
    var auth = new NtlmPasswordAuthentication("Domain", "username", "Password");

    //Make path Name
    string path = $"smb://Nascld/Share/DeliveriesPictures/{piece}.jpg";

    //Get target's SmbFile.
    var file = new SmbFile(path, auth);

    //Create new file
    file.CreateNewFile();

    //Get writable stream.
    var writeStream = file.GetOutputStream();

    //Write bytes.
    writeStream.Write(image);

    //Create reading buffer.
    var memStream = new MemoryStream();

    //Dispose writable stream.
    writeStream.Dispose();

    IDeliveryService client = Common.GetDeliveryService();
    //client.TransformEqual(_callContext, piece, journalSrc, type, id, journalDest);
}

and it worked

Answered by Elgate on December 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP