Monday, 15 September 2014

service - Android Google changeListener -


I'm trying to run Android Google Drive I am using the Gitb Sample Code and Android Demos.

I've added Google Play services to my project. It is an error getting Iam:

  Import com.google.android.gms.drive.events.DriveEvent .ChangeListener can not be solved  

after reading this page ()

I changed it to import

  Com.google.android.gms.drive.events.ChangeListener  

However, the error still exists in those two ways:

  Type can not be solved  

-

  Private zeroes toggle () {if (mSelectedFileId == zero) {return; } Synchronize (mSubscribeStatusLock) {DriveFile file = Drive.DriveApi.getFile (getGoogleApiClient (), mSelectedFileId); If (! Subscribed!) {Log D. (Tag, "file changes are starting to listen."); File.addChangeListener (getGoogleApiClient (), changeListener); // error is subscribed = true; } And {Log D. (The tag is "stopping to listen for file changes."); File.removeChangeListener (getGoogleApiClient (), changeListener); // error subscribed = false; }} Refresh (); }  

-

  the ultimate personal listener & lt; ChangeEvent & gt; ChangeListener = New Audience & lt; ChangeEvent & gt; () {// Error @Everride Events on Public Zero (ChangeEvent Event) {mLogTextView.setText (String.format ("File Change Event:% s", Event)); }};   

"text">

I use this code I am:

  Import com.google.android.gms.common.api.PendingResult; Import com.google.android.gms.common.api.ResultCallback; Import Com.google.android.gms.common.api.Status; Import com.google.android.gms.drive.Drive; Import Com.google.android.gms.drive.DriveApi; Import Com.google.android.gms.drive.DriveResource; Import Com.google.android.gms.drive.events.ChangeEvent; Import com.google.android.gms.drive.events.ChangeListener; PendingResult & LT; DriveApi.DriveIdResult & gt; Pending = Resolver = Drive.Drive API.fet Drive (mGoogleApiClient, id); Pending Result.SetContact Collapseback (New result callback & lt; DriveApi.DriveIdResult & gt; () {@Override Result at Public Zero (@NonNull DriveApi.DriveIdResult driveIdResult) {If (! Driveindracelet .getStatus) .isSuccess ()) {Log D (Tag, String Format ("Fetch Drive ID Error:% s", Drive Idriscult.Tetatus (). GetStatusMessage ()); Return;} mCurrentDriveId = driveIdResult.getDriveId (); Drive Resource Source = mCurrentDriveId.asDriveResource (); Log D. (Tag, "drive from ID"); Pending vacancies & lt; position & gt; pending = Resource. AddChangeListener (mGoogleApiClient, New ChangeListener) {@Override ChangeEvent changeEvent} {onResourceChange (changeEvent);}}); Changes pending.SeterSet callback (new result callback <<< Override P negative result at zero (@NonNull position status) {if (status.isSuccess ()) {Log D. (Tag, "Change the success of the listener");} Other {log D. (tag, string.format "Change listeners error:% s", status.getStatusMessage ())); }}}); }});  

But it seems that the changes are not very real time anyway getFile () is obsolete.


No comments:

Post a Comment