This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Code to download. | |
| Drive drive = getDriveService(googleSignInAccount); | |
| com.google.api.services.drive.model.File driveFile = searchFromGoogleDrive(drive); | |
| File downloadedZipFile = downloadFromAppFolder(drive, driveFile); | |
| // Code to upload. | |
| Drive drive = getDriveService(googleSignInAccount); | |
| com.google.api.services.drive.model.File driveFile = searchFromGoogleDrive(drive); | |
| uploadToAppFolder(drive, driveFile, zipFile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void startMediaRecorder() { | |
| mediaRecorder = new MediaRecorder(); | |
| mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); | |
| mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); | |
| mediaRecorder.setAudioChannels(1); | |
| mediaRecorder.setAudioSamplingRate(8000); | |
| mediaRecorder.setAudioEncodingBitRate(32000); | |
| /* | |
| mediaRecorder.setAudioChannels(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Minimize the execution scope of new user thread. | |
| // Most code still run in UI thread, except isBillingSupported. | |
| // Ensure user thread doesn't deal with member variable. | |
| @Override | |
| public void onServiceConnected(ComponentName name, IBinder service) { | |
| BillingHelper.logVerbose(TAG, "Billing service connected."); | |
| mService = IInAppBillingService.Stub.asInterface(service); | |
| String packageName = mApplicationContext.getPackageName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| java.lang.IndexOutOfBoundsException: | |
| at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline (RecyclerView.java:6023) | |
| at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5958) | |
| at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5954) | |
| at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next (LinearLayoutManager.java:2226) | |
| at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk (LinearLayoutManager.java:1557) | |
| at androidx.recyclerview.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1517) | |
| at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren (LinearLayoutManager.java:622) | |
| at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1 (RecyclerView.java:3941) | |
| at androidx.recyclerview.widget.RecyclerView.dispatchLayout (RecyclerView.java:3705) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exception.class.missing._Unknown_: View Holder 2 | |
| at androidx.recyclerview.widget.RecyclerView.handleMissingPreInfoForChangeError (RecyclerView.java:4124) | |
| at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3 (RecyclerView.java:4048) | |
| at androidx.recyclerview.widget.RecyclerView.dispatchLayout (RecyclerView.java:3718) | |
| at androidx.recyclerview.widget.RecyclerView.onLayout (RecyclerView.java:4260) | |
| at android.view.View.layout (View.java:18804) | |
| at android.view.ViewGroup.layout (ViewGroup.java:5951) | |
| at android.widget.FrameLayout.layoutChildren (FrameLayout.java:323) | |
| at android.widget.FrameLayout.onLayout (FrameLayout.java:261) | |
| at android.view.View.layout (View.java:18804) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private boolean isHeAacEncoderSupported() { | |
| if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { | |
| int numCodecs = MediaCodecList.getCodecCount(); | |
| for (int i = 0; i < numCodecs; i++) { | |
| MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); | |
| if (!codecInfo.isEncoder()) { | |
| continue; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Uri uri = Uri.fromFile(destination); | |
| MediaMetadataRetriever mmr = new MediaMetadataRetriever(); | |
| mmr.setDataSource(WeNoteApplication.instance(), uri); | |
| String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
| long length = 0L; | |
| try { | |
| length = Long.parseLong(durationStr); | |
| } catch (NumberFormatException e) { | |
| Log.e(TAG, "", e); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void startMediaRecorder() { | |
| mediaRecorder = new MediaRecorder(); | |
| mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); | |
| mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); | |
| mediaRecorder.setAudioChannels(1); | |
| mediaRecorder.setAudioSamplingRate(8000); | |
| mediaRecorder.setAudioEncodingBitRate(32000); | |
| /* | |
| mediaRecorder.setAudioChannels(1); | |
| mediaRecorder.setAudioSamplingRate(44100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SyncForegroundIntentService extends IntentService { | |
| @Override | |
| protected void onHandleIntent(@Nullable Intent intent) { | |
| try { | |
| NotificationCompat.Builder builder = ... | |
| startForeground(SYNC_FOREGROUND_INTENT_SERVICE_ID, builder.build()); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2019-07-15 19:09:50.771 16243-16482/com.yocto.wenote E/Utils: com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden | |
| { | |
| "code": 403, | |
| "errors": [ | |
| { | |
| "domain": "usageLimits", | |
| "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", | |
| "reason": "dailyLimitExceededUnreg", | |
| "extendedHelp": "https://code.google.com/apis/console" | |
| } |