#StackBounty: #android #privacy #ios #chromecast #privacy-protection How to set up a Chromecast without logging in to Google Home?

Bounty: 50

I have a Chromecast audio and the Google Home app now requires location access and for you to log in. I don’t want to give it either, and therefore it does not help me set up the device. There is no way to bypass the requirements, unlike previous versions.

I can’t think of a reason to require both of them, save to send back to Google HQ for analysis.

Is there some other method I can use to set up the Chromecast?

This isn’t an android or iOS specific question, but those are the usual platforms to use the chromecast, followed up by the PC. If this doesn’t fit SuperUser, I can move it.


Get this bounty!!!

#StackBounty: #android #android-permissions Screen Overlay Detected | Lenovo, Redmi & Samsung Devices

Bounty: 100

I have created an app which continuously run in background and show an floating overlay TextView(By using the permission android.permission.SYSTEM_ALERT_WINDOW).

I have problem in Lenovo android devices, when other applications try to request for user permission there is an alert dialog says “Screen Overlay Detected”. While I have test the same application on Redmi 3S Prime device the “Allow” button in permission dialog is not clickable, until I have turned off the Floating Overlay TextView in my application.

So is there any solution to resolve this device specific issue? One of the possible solution may be disable floating TextView while permission dialog is visible to user and show floating overlay when permission dialog is closed, but the problem is how can I detect the permission dialog open/close state from my app.

Please suggest…


Get this bounty!!!

#StackBounty: #java #android #android-activity #screen Process the command without launching MainActivity, in Android

Bounty: 50

I am new to android and stuck at one point with my new screen off test application. I am trying to develop an Android application to turn off or lock the screen directly by clicking the app launcher icon of the application.

I am able to lock the screen with the functionality I want but with one problem. While i click on the screen lock icon in the launcher it takes around a second and then locks the screen (Time is taken by to MainActivity to launch).

I want that time delay to be removed and just wanted to process the command to lock phone when user tap on the app icon in the launcher. But am not able to figure it out.

Here is AndroidManifest.xml

<application
    android:theme="@android:style/Theme.NoDisplay"
    android:label="@string/app_name"
    android:icon="@drawable/ic_launcher"
    android:allowBackup="true">

    <activity android:name=".MainActivity"
        android:excludeFromRecents="true"
        android:launchMode="singleTask">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <receiver android:name="ScreenOffAdminReceiver"
        android:permission="android.permission.BIND_DEVICE_ADMIN">
        <meta-data android:name="android.app.device_admin"
            android:resource="@xml/permissions" />
        <intent-filter>
            <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
        </intent-filter>
    </receiver>

</application>

MainActivity.java

public class MainActivity extends Activity {

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        DevicePolicyManager deviceManger = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
        ComponentName compName = new ComponentName(this, ScreenOffAdminReceiver.class);
        if (deviceManger.isAdminActive(compName)) {
            deviceManger.lockNow();
            finish();
        } else {
            Intent intent = new Intent("android.app.action.ADD_DEVICE_ADMIN");
            intent.putExtra("android.app.extra.DEVICE_ADMIN", compName);
            intent.putExtra("android.app.extra.ADD_EXPLANATION", getString(R.string.devicePolicyManagerMsg));
            startActivityForResult(intent, 0);
        }
        Process.killProcess(Process.myPid());
    }
}

ScreenOffAdminReceiver.java

public class ScreenOffAdminReceiver extends DeviceAdminReceiver {
    public void onDisabled(Context context, Intent intent) {
        Toast.makeText(context, R.string.deviceAdminDisabled, Toast.LENGTH_SHORT).show();
    }

    public void onEnabled(Context context, Intent intent) {
        Toast.makeText(context, R.string.deviceAdminEnabled, Toast.LENGTH_SHORT).show();
    }
}

I just want to remove the DELAY while locking the screen. Any help will be highly appreciated. Thanks


Get this bounty!!!

#StackBounty: #android #cordova #google-chrome #google-chrome-devtools #phonegap Cordova app crashes when using Chrome DevTools

Bounty: 150

I’m creating an app in Cordova for Android, and I’m using Chrome DevTools for debugging. But everytime I use inspect element my app crashes without showing any errors.

It won’t happen if I just start DevTools and my app, it will only happen when I use inspect element. I don’t have much code yet, only an index file that loads all the JavaScript and CSS files and shows some images for my loading page.

There are no errors showing up in my console either.

Chrome Version 57.0.2987.133
Samsung Galaxy Edge 7
Android 7.0
Cordova 6.5.0

UPDATE:
Tested in a newer version of Chrome (58.0.3029.96) and the problem still exists.

UPDATE:
I’m using a real device but the problem also exists when using emulated devices through Android Studio.


Get this bounty!!!

#StackBounty: #android #pjsip How to know incoming call have video or not in PJSIP in android

Bounty: 50

I’m working on PJSIP in android, How to check incoming call is only audio call or video.?? How identify? I have used below code but it’s not working

 @Override
    public void onIncomingCall(OnIncomingCallParam prm) {
        System.out.println("======== Incoming call ======== ");
        MyCall call = new MyCall(this, prm.getCallId());
        try {
            CallSetting setting = call.getInfo().getSetting();
            Log.d(" Log APP ", "onIncomingCall: Audio " + setting.getAudioCount() + "  Video" + setting.getVideoCount());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

But audio and video count always come 1 but while making call, I have put video 0

 MyCall call = new MyCall(account);
        CallOpParam prm = new CallOpParam();
        CallSetting setting = new CallSetting();
        setting.setAudioCount(1);
        setting.setVideoCount(0);
        prm.setOpt(setting);
        try {
            call.makeCall(buddy_uri, prm);
        } catch (Exception e) {
            call.delete();
            e.printStackTrace();
            return;
        }

Please tell me hows to identify incoming call has video or not .?


Get this bounty!!!

#StackBounty: #android #recyclerview #android-progressbar #recycler-adapter ProgressBar is not refreshing in RecyclerView.Adapter

Bounty: 50

I am facing an issue with progressBar.setProgress and progressBar.setMax.

I am having two items and generally need to show the progress of the video as like attached screen shot. For first item only I have the some progress data after set that progress I need to set progress to 0(zero) for second item. But second item progressbar is not resetted to back to zero instead of this it is still showing first item’s progress length.

I printed the values for Items here:

// Item1
Media List total Duration : 84063
Media List total ProgressDuration : 19380
// Item2
Media List total Duration : 0
Media List total ProgressDuration : 0

Adapter Code :

class ViewHolder extends RecyclerView.ViewHolder {
    TextView fileName;
    ImageView ivThumbNail;
    ProgressBar progressBar;
    View mainContainer;
    View view;

    ViewHolder(View itemView) {
        super(itemView);
        view = itemView;
        mainContainer = itemView.findViewById(R.id.main_container);
        fileName = (TextView) itemView.findViewById(R.id.tv_file_name);
        ivThumbNail = (ImageView) itemView.findViewById(R.id.iv_thumbnail);
        progressBar = (ProgressBar) itemView.findViewById(R.id.progress_bar);
    }
}

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(context).inflate(R.layout.media_row, parent, false);
    return new ViewHolder(itemView);
}

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    final Media media = mediaList.get(position);

    String videoUrl = media.video_url;

    int totalDuration = VideoPositionVo.getTotalDuration(context, videoUrl, media.course_id);
    int progressDuration = VideoPositionVo.getResumedPosition(context, videoUrl, media.course_id);

    Log.d("Media List total Duration : " , totalDuration);
    Log.d("Media List total ProgressDuration : " , progressDuration);

    holder.progressBar.invalidate();
    holder.progressBar.setMax(totalDuration);
    holder.progressBar.setProgress(progressDuration);


    String sampleThumbNail = "https://i.vimeocdn.com/video/23566238_100x75.webp";
    aQuery.id(holder.ivThumbNail).image(sampleThumbNail, true, true, imageWidth, 0);
    holder.fileName.setText(media.video_label);

}

Adapter row xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:elevation="4dp"
    android:foreground="?android:attr/selectableItemBackground"
    android:orientation="vertical"
    android:paddingBottom="4dp"
    android:paddingEnd="4dp"
    app:cardCornerRadius="2dp"
    app:cardElevation="2sp"
    app:cardUseCompatPadding="true">


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/iv_thumbnail"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clickable="false"
            android:scaleType="centerCrop"
            android:contentDescription="@string/media"
            android:visibility="visible" />

        <RelativeLayout
            android:id="@+id/main_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/black_transparent_dark">

            <ImageView
                android:id="@+id/iv_file_type"
                android:layout_width="76dp"
                android:layout_height="76dp"
                android:layout_centerInParent="true"
                android:contentDescription="@string/media"
                android:scaleType="centerCrop"
                android:src="@drawable/ic_play" />

            <TextView
                android:id="@+id/tv_file_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:layout_above="@+id/progress_bar"
                android:ellipsize="end"
                android:gravity="center"
                android:maxLines="2"
                android:text="fileName"
                android:textColor="@color/white"
                android:textStyle="bold" />


            <ProgressBar
                android:id="@+id/progress_bar"
                style="@android:style/Widget.ProgressBar.Horizontal"
                android:layout_width="match_parent"
                android:layout_height="6dp"
                android:indeterminate="false"
                android:layout_alignParentBottom="true"
                android:max="0"
                android:progress="0"
                android:progressDrawable="@drawable/video_progress_bar"
                android:visibility="visible" />
        </RelativeLayout>   

    </RelativeLayout>

</android.support.v7.widget.CardView>

Screen Shot :
screenshot


Get this bounty!!!

#StackBounty: #android #recyclerview #android-textview #android-recyclerview "android:textIsSelectable="true" not workin…

Bounty: 50

I know that setting android:textIsSelectable="true" in xml for the TextView will show the native text selection popup and I’ve been using that in my application. But what I found that it is not working any more when I try to set the same attribute in a view attached to the RecyclerView.
Whenever I try to select the text the following log appears –

TextView: TextView does not support text selection. Action mode cancelled.

And I don’t know why? Why it works on other screens and not with the RecyclerView. I read multiple posts –

TextView with android:textIsSelectable="true" not working in listview

textview textIsSelectable="true" not working in Listview

android:textIsSelectable="true" for TextView inside Listview does not work

But then I encountered this post –

Android: "TextView does not support text selection. Action mode cancelled"

And the reply by @hungkk worked for me. His solution suggested the TextView width to change to wrap_content from match_parent.

I know I can do this but my question is how this fixed the issue because it looks weird to me. And also, what is the solution if I want to keep the width to match_parent.

Any inputs are welcome.


Get this bounty!!!

#StackBounty: #java #android #android-studio #android-gradle #nine-patch Error on nine patch image: Some file crunching failed, see log…

Bounty: 250

I cannot add a ninepatch png to my project because of this build error:

Information:Gradle tasks [:app:assembleDebug] Error:Some file
crunching failed, see logs for details Error:Execution failed for task
‘:app:mergeDebugResources’.

Error: Some file crunching failed, see logs for details Information:BUILD FAILED Information:Total time: 11.955 secs
Information:2 errors Information:0 warnings Information:See complete
output in console

Fact: I have already added one which runs perfectly, the other one is made with the very same methodology, same boundaries and stuff yet makes build error.

I have tried:

  • Clean
  • Rebuild project
  • Restart AS
  • Restart PC
  • Made nine patch with Photoshop
  • Made nine patch with AS built in nine patch maker
  • Various naming conventions
  • Shorten the dir path of the project
  • Adding crunch: false to gradle

Extra wtf:

  • If i just copy the pixel contents of the not working nine patch to the working one the error appears.

Also, the error says “see logs”

Where are the logs???

Because its not in logcat thats for sure.

Please help if you can. This drives me nuts.
Im really interested why I have to spend half a day with an image import.


Get this bounty!!!

#StackBounty: #android #drawable #android-drawable Android: Drawable vertically alignment for SeekBar

Bounty: 50

This is waht I need to achieve with xml drawable for SeekBar:
enter image description here

I tried many different variations and this is best I could make.

This is seekbar_thumb_drawable.xml:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >

    <solid android:color="@color/accent_color"/>

    <size
        android:height="20dp"
        android:width="20dp" />

</shape>

This is seekbar_drawable.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@android:id/background"
        android:height="5dp"
        android:top="7.5dp">
        <shape
            android:shape="rectangle">
            <solid android:color="@color/seekbar_background" />
            <corners android:radius="2.5dp" />
        </shape>
    </item>

    <item
        android:id="@android:id/progress"
        android:height="10dp"
        android:top="5dp">
        <clip>
            <shape
                android:shape="rectangle">
                <solid android:color="@color/seekbar_progress" />
                <corners android:radius="5dp" />
            </shape>
        </clip>
    </item>

</layer-list>

Result on API 18:
Problem is that lines are not verticaly centered.

enter image description here

Result on API 24:
This display exactly how I want it to display.

enter image description here

Is there any possible solution to make this appear as on first picture on all devices from API 16?
I do not want to use nine-patch, because I need to use color from resources.
I tried padding, gravity, top, bottom, inter-shape, line, rectangle but I could not find solution…


Get this bounty!!!

#StackBounty: #android #arraylist #filtering #android-adapter #autocompletetextview Get filtered array size in AutoCompleteTextview

Bounty: 50

I am working on the project in which user can search data. For that, I have implemented AutoCompleteTextView.

 autoComplete.setAdapter(new ArrayAdapter<String>(CheckRiskActivity.this,
                                        R.layout.auto_text_row, druglist));
                                autoComplete.setThreshold(1);
//druglist is my arraylist

Text change listener is as below:

autoComplete.addTextChangedListener(new TextWatcher() {

        @Override
        public void afterTextChanged(Editable s) {
            // here I want to get the size of filtered array list every time when the user adds any character.
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start,
                                      int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start,
                                  int before, int count) {
        }
    });

Explanation: If my initial array size is 100 and if the user types ‘a’, then I want to get the size of filtered array.

Note: I have tried autoComplete.getAdapter().getCount(); but it gives the actual result after adding one more character.


Get this bounty!!!