--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/3b1807d5-5f4c-45da-bf21-22cdd8ddebff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.d("appLog", "getExternalFilesDirs");
for (File f : getExternalFilesDirs(null)) {
Log.d("appLog", f.getAbsolutePath());
}
// Got the below path from calling getExternalFilesDirs()
File newFile = new File("/storage/6E0A-1308/Android/data/com.example.sampletest/files");
try {
FileOutputStream newFs = new FileOutputStream(newFile);
newFs.write("test message".getBytes());
newFs.close();
Log.d("appLog", "Successfully wrote test file to SD card");
} catch (Exception e) {
Log.e("appLog", "Err: ", e);
}
final StitchAppClientConfiguration.Builder stitchAppClientBuilder = new StitchAppClientConfiguration.Builder();
Log.d("appLog", "Made Configuration Builder");
final StitchAppClientConfiguration stitchAppClientConfiguration = stitchAppClientBuilder.withDataDirectory("/storage/6E0A-1308/Android/data/com.example.sampletest/files").build();
Log.d("appLog", "Made Configuration");
final StitchAppClient stitchAppClient = Stitch.initializeAppClient("stitchdocsexamples-pqwyr", stitchAppClientConfiguration);
Log.d("appLog", "Made StitchAppClient");
final MongoClient mongoMobileClient = stitchAppClient.getServiceClient(LocalMongoDbService.clientFactory);
Log.d("appLog", "Made MongoMobileClient");
final MongoCollection coll = mongoMobileClient.getDatabase("store").getCollection("items");
Log.d("appLog", "Made Collection");
// Test to make sure we can insert / read
coll.insertOne(new Document().append("hey", "hello"));
Log.d("appLog", String.format("Found Docs: %s", coll.find().first().toString()));
Log.d("appLog", String.format("Count of Docs: %d", coll.countDocuments()));
}
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/cd9fe5a4-ff3a-47fb-916b-5a673d424db9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.