I am developing an Android app to manipulate Evernote notes. In one of the use cases, I need to access the notes from publicly shared notebook from other user.
I tried getting getPublicUserInfo.
PublicUserInfo pubInfo = null;
pubInfo = mEvernoteSession.getClientFactory().createUserStoreClient().getClient().getPublicUserInfo("user name");
mEvernoteSession.getClientFactory().createNoteStoreClient().getPublicNotebook(.......)
But first method is always throwing Exception (TException).
What am I doing wrong?
OK folks I got the solution for getting public notes.
1st Step: Get userid and uri of the public notebook
How to get user id and uri -->
First of, try to get the url of the public note.. Lets take an example
https://www.evernote.com/pub/evertemplate138/evertemplate
In above url, "evertemplate138" is the user id and "evertemplate" is the uri.
2nd Step: Create Linked notebook instance for the public notebook
You can create using the method createLinkedNotebook
3rd Step: Get syncchunk data using method - getLinkedNotebookSyncChunk
4th Step: Get shared notes using syncchunk data
Code snippet:
inkedNotebook linkedNotebook1 = new LinkedNotebook();
linkedNotebook1.setShareName("<Name of notebook>");
linkedNotebook1.setUsername("evernote user id");
linkedNotebook1.setUri("uri of the public notebook");
notestore.createLinkedNotebook(linkedNotebook1, new OnClientCallback<LinkedNotebook>()
{
public void onSuccess(LinkedNotebook data) {
notestore.getLinkedNotebookSyncChunk(data, 0, 100, true, new OnClientCallback<SyncChunk>() {
public void onSuccess(SyncChunk Syncdata) {
SharedNotes = data.getNotes();
}
}
}
} );
Related
I am trying to implement the ad in my app with Custom Native Ad Format - https://developers.google.com/ad-manager/mobile-ads-sdk/android/native/custom-formats#java_1
So, according to the documentation I am going with the approach described there and creating the ad
...
private void setListeners() {
...
imageView.setOnClickListener(v -> {
nativeCustomFormatAd.performClick("IMAGE");
});
...
}
private NativeCustomFormatAd nativeCustomFormatAd;
AdLoader adLoader = new AdLoader.Builder(context, "/6499/example/native")
.forCustomFormatAd("10063170",
new NativeCustomFormatAd.OnCustomFormatAdLoadedListener() {
#Override
public void onCustomFormatAdLoaded(NativeCustomFormatAd ad) {
// Show the custom format and record an impression.
nativeCustomFormatAd = ad;
Drawable drawable = vm.nativeCustomFormatAd.getImage("IMAGE").getDrawable();
imageView.setDrawable(drawable);
}
},
new NativeCustomFormatAd.OnCustomClickListener() {
#Override
public void onCustomClick(NativeCustomFormatAd ad, String s) {
// Handle the click action
}
})
.withAdListener( ... )
.withNativeAdOptions( ... )
.build();
#SuppressLint("VisibleForTests")
AdManagerAdRequest adManagerAdRequest = new AdManagerAdRequest.Builder().build();
adLoader.loadAd(adManagerAdRequest);
...
So, it looks pretty simple I try to make a request for the ad then I got (in a callback) NativeCustomFormatAd, save it as a class member, and along with it get drawable and set it to the imageView (to present it in the UI). Once a user clicks on the imageView I get an event in the click listener and invoke nativeCustomFormatAd.performClick("IMAGE");.
The problem is that I expect that once I transfer the ad click to the SDK (by nativeCustomFormatAd.performClick("IMAGE");) SDK is supposed to open the external browser, but instead nothing happens.
P.S. I am sure that nativeCustomFormatAd.performClick("IMAGE"); getting invoked and also I see that SDK gets the click as I got a callback event here:
...
new NativeCustomFormatAd.OnCustomClickListener() {
#Override
public void onCustomClick(NativeCustomFormatAd ad, String s) {
// Handle the click action
}
})
...
What am I missing here?
According to the docs you linked:
When a click is performed on a custom format ad, there are three possible responses from the SDK, attempted in this order:
Invoke the OnCustomClickListener from AdLoader, if one was provided.
For each of the ad's deep link URLs, attempt to locate a content resolver and start the first one that resolves.
Open a browser and navigate to the ad's traditional Destination URL.
Also:
If you pass a listener object in, the SDK instead invokes its onCustomClick method and takes no further action.
Therefore, it seems you have to pass a null OnCustomClickListener.
I have Sensors from them i want to Display the Data of the Sensor(Accelorometer, Gyroscope, Magnetometer) and log that recorded data.
From the Documentation I see following PUT and GET Requests that I need to perform. I also have a Example but that is written in java but I'm not familiar with Java.
PUT /Mem/DataLogger/Config that lists paths that you want to log.
In my case they would be /Meas/IMU9/104 and /Meas/Temp.
PUT /Mem/DataLogger/State to 3 (=LOGGING)
PUT /Mem/DataLogger/State to 2 (=READY)
GET "suunto:/MDS/Logbook/{serial}/Entries" on mobile to have a list of entries on the sensors datamemory. The one with biggest LogID is the one you just recorded
GET "suunto:/MDS/Logbook/{serial}/byId/{LogId}/Data" on mobile to get the recording as JSON.
For all that i need the http Plugin. I started with creating Final String's for the Entries.
My current Code looks like:
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:mdsflutter/Mds.dart';
class DataLoggerActivity extends StatefulWidget {
final String URI_MDS_LOGBOOK_ENTRIES = "suunto://MDS/Logbook/{0}/Entries";
final String URI_MDS_LOGBOOK_DATA = "suunto://MDS/Logbook/{0}/ById/{1}/Data";
final String URI_LOGBOOK_ENTRIES = "suunto://{0}/Mem/Logbook/Entries";
final String URI_DATALOGGER_STATE = "suunto://{0}/Mem/DataLogger/State";
final String URI_DATALOGGER_CONFIG = "suunto://{0}/Mem/DataLogger/Config";
#override
_DataLoggerActivityState createState() => _DataLoggerActivityState();
}
class _DataLoggerActivityState extends State<DataLoggerActivity> {
#override
Widget build(BuildContext context) {
return Container();
}
}
First, the GET & PUT are not HTTP calls (so no HTTP plugin), but calls in MDS library. Please check the latest mdsflutter plugin and the example within.
Full disclosure: I work for the Movesense team
I am using the new Google Places SDK: AutocompleteSupportFragment.
whenever i select an address from the result list it doesn't save it and show it on the field.
I am not sure why.
this is my code below:
i declaed the variable at the top of the class:
Place shipAddress;
and called this method where i needed:
final AutocompleteSupportFragment editAddress = (AutocompleteSupportFragment) getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment);
editAddress.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME));
editAddress.setOnPlaceSelectedListener(new PlaceSelectionListener() {
#Override
public void onPlaceSelected(Place place) {
shipAddress = place;
}
#Override
public void onError(Status status) {
Log.e("ERROR", status.getStatusMessage());
}
});
i am also using the result in another method calling:
address = shipAddress.getAddress().toString();
but finally i get an error that
variable address is invoked on a null object.
Places SDK has been Depricated You need to migrate to new PLACES
API.. You can find solution by below guideline.
https://stackoverflow.com/a/55045772/10579969
Official page https://developers.google.com/places/android-sdk/client-migration#place_picker
I am developing an app in which i have an integrated google drive. I want to store images captured by the device under a folder in google drive.
By doing so in result.getstatus() method from google service is returning {statusCode=Failed to retrieve item from a network}
I am using following function,
final ResultCallback<DriveIdResult> idCallback = new ResultCallback<DriveIdResult>() {
#Override
public void onResult(DriveIdResult result) {
System.out.println("result.getStatus()----"+ result.getStatus());
System.out.println("result.getStatus() code----"+ result.getStatus().getStatusCode());
if (!result.getStatus().isSuccess()) {
showMessage("Cannot find DriveId. Are you authorized to view this file?");
return;
}
DriveFolder folder = Drive.DriveApi
.getFolder(getGoogleApiClient(), result.getDriveId());
MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
.setTitle("NewFolder").build();
folder.createFolder(getGoogleApiClient(), changeSet)
.setResultCallback(createFolderCallback);
}
};
In first println---> I am getting {statusCode=Failed to retrieve item from a network}
In second println--> I am getting 7
Please help me...
I have the same status code when the file is permanently deleted. Remove any cached DriveId / resource id and create the new file.
I was a beginner of facebook SDK.
I have reference the facebook SDK sample inside "HellowFacebookSampleActivity"file
and know how to use Request.newStatusUpdateRequest (post to the user's own Wall)
But I do not know how to use Request.newPostRequest to post article to specific friend's wall and do not know how to use the inside parameters .In particular,I dont know how to use the third GraphObject parameter.
I have been found a lot of information, but because the API has been revised ,so the information could not be used.
Is there some examples or website allows me to accomplish this goal?
Thank you so much!
Here is the code that I want to used to be changed.
private void postStatusUpdate() {
if (user != null && hasPublishPermission()) {
final String message = getString(R.string.status_update, user.getFirstName(), (new Date().toString()));
Request request = Request.newStatusUpdateRequest(Session.getActiveSession(), message, new Request.Callback() {
//Request request = Request.newPostRequest(Session.getActiveSession(), "1000001851621**",GraphObject??? , new Request.Callback() {
#Override
public void onCompleted(Response response) {
showPublishResult(message, response.getGraphObject(), response.getError());
}
});
request.executeAsync();
} else {
pendingAction = PendingAction.POST_STATUS_UPDATE;
}
}
Facebook updated their SDK a few months ago to require you to use a native feed dialog instead of your own method. This makes it so the user has to look at the pre-made facebook window to post anything on another person's wall.
Blog Post