alexa avs integrated android app showing offline
i have integrated amazon avs in my android app. It is working fine with default Skills. But unable to execute custom skills because my device is showing offlinein alexa companion app.
See also questions close to this topic
-
Compressing Image using AsyncTask before uploading to Firebase Storage
I'm trying to compress a images before uploading them to Firebase Storage using this class that extends AsyncTask
` public class BackgroundImageResize extends AsyncTask{
Bitmap mBitmap; public BackgroundImageResize(Bitmap bitmap) { if(bitmap != null){ this.mBitmap = bitmap; } } @Override protected void onPreExecute() { super.onPreExecute(); Toast.makeText(NextActivity.this, "compressing image", Toast.LENGTH_SHORT).show(); // showProgressBar(); } @Override protected byte[] doInBackground(Uri... params) { Log.d(TAG, "doInBackground: started."); if(mBitmap == null){ try{ mBitmap = MediaStore.Images.Media.getBitmap(NextActivity.this.getContentResolver(), params[0]); }catch (IOException e){ Log.e(TAG, "doInBackground: IOException: " + e.getMessage()); } } byte[] bytes = null; bytes = getBytesFromBitmap(mBitmap, 100); return bytes; } @Override protected void onPostExecute(byte[] bytes) { super.onPostExecute(bytes); mUploadBytes = bytes; // hideProgressBar(); //execute the upload task } } public static byte[] getBytesFromBitmap(Bitmap bitmap, int quality){ ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, quality,stream); return stream.toByteArray(); }
`
using this onClickView to call it
` public void onClick(View v) { Log.d(TAG, "onClick: navigating to the final share screen.");
//Compress the image try{ backgroundImageResize.execute() ; } catch (NullPointerException e) {} //upload the image to firebase Toast.makeText(NextActivity.this, "Attempting to upload new photo", Toast.LENGTH_SHORT).show(); String caption = mCaption.getText().toString(); if(intent.hasExtra(getString(R.string.selected_image))){ imgUrl = intent.getStringExtra(getString(R.string.selected_image)); mFirebaseMethods.uploadNewPhoto(getString(R.string.new_photo), caption, imageCount, imgUrl,null); } else if(intent.hasExtra(getString(R.string.selected_bitmap))){ bitmap = (Bitmap) intent.getParcelableExtra(getString(R.string.selected_bitmap)); mFirebaseMethods.uploadNewPhoto(getString(R.string.new_photo), caption, imageCount, null,bitmap); }
`
My question is, how do I pass the bitmap or url to this BackgroundImageResize at onCLickListener ?
this is the firebase storage upload method
public void uploadNewPhoto(String photoType, final String caption,final int count, final String imgUrl, Bitmap bm){ Log.d(TAG, "uploadNewPhoto: attempting to uplaod new photo."); FilePaths filePaths = new FilePaths(); //case1) new photo if(photoType.equals(mContext.getString(R.string.new_photo))){ Log.d(TAG, "uploadNewPhoto: uploading NEW photo."); String user_id = FirebaseAuth.getInstance().getCurrentUser().getUid(); StorageReference storageReference = mStorageReference .child(filePaths.FIREBASE_IMAGE_STORAGE + "/" + user_id + "/photo" + (count + 1)); //convert image url to bitmap if(bm == null){ bm = ImageManager.getBitmap(imgUrl); } byte[] bytes = ImageManager.getBytesFromBitmap(bm, 90); UploadTask uploadTask = null; uploadTask = storageReference.putBytes(bytes); uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Uri firebaseUrl = taskSnapshot.getDownloadUrl(); Toast.makeText(mContext, "photo upload success", Toast.LENGTH_SHORT).show(); //add the new photo to 'photos' node and 'user_photos' node addPhotoToDatabase(caption, firebaseUrl.toString()); //navigate to the main feed so the user can see their photo Intent intent = new Intent(mContext, HomeActivity.class); mContext.startActivity(intent); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.d(TAG, "onFailure: Photo upload failed."); Toast.makeText(mContext, "Photo upload failed ", Toast.LENGTH_SHORT).show(); } }).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() { @Override public void onProgress(UploadTask.TaskSnapshot taskSnapshot) { double progress = (100 * taskSnapshot.getBytesTransferred()) / taskSnapshot.getTotalByteCount(); if(progress - 15 > mPhotoUploadProgress){ Toast.makeText(mContext, "photo upload progress: " + String.format("%.0f", progress) + "%", Toast.LENGTH_SHORT).show(); mPhotoUploadProgress = progress; } Log.d(TAG, "onProgress: upload progress: " + progress + "% done"); } });
-
Calling a Progressive Web App from another android application
i have a question I've got a PWA and i want to open it from another application using the url like mypwascheme:http://my.test.host/mypage
But i have no idea what should i use for the scheme part, ie. mypwascheme
I tried my app's name & short name from the manifest.json but neither did work
Any ideas? Thanks in advance
-
rxjava throws OnErrorNotImplementedException
Observable.create(new ObservableOnSubscribe()) .subscribeOn(Schedulers.io()) .compose(new ParserTransformer()) .map() .subscribe()
When something wrong in my ObservableOnSubscribe, it throws an exception(java.net.UnknownHostException ...).
ObservableOnSubscribe:
public void subscribe(ObservableEmitter oe) throws Exception { try{ ... } catch { if (!oe.isDisposed()) { if (ex instanceof IOException) { throw new NetException(...); //sometimes, it make the app crash! } } else{ ... } } oe.onComplete(); }
here's the log :
D OkHttp: error: java.net.UnknownHostException D OkHttp: oe.isDisposed: false W System.err: io.reactivex.exceptions.OnErrorNotImplementedException: Unable to resolve host ******: No address associated with hostname W System.err: at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704) W System.err: at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701) W System.err: at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:77) W System.err: at io.reactivex.internal.observers.BasicFuseableObserver.onError(BasicFuseableObserver.java:100) W System.err: at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.checkTerminated(ObservableObserveOn.java:276) W System.err: at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:172) W System.err: at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:252) W System.err: at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109) W System.err: at android.os.Handler.handleCallback(Handler.java:754) W System.err: at android.os.Handler.dispatchMessage(Handler.java:95) W System.err: at android.os.Looper.loop(Looper.java:163) W System.err: at android.app.ActivityThread.main(ActivityThread.java:6343) W System.err: at java.lang.reflect.Method.invoke(Native Method) W System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880) W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Why this happen? Why rxjava says that OnError is not implemented?